@liveblocks/core 3.20.0-rc1 → 3.21.0-exp1

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.cts CHANGED
@@ -64,6 +64,83 @@ type DistributiveRelax<T, Ks extends string | number | symbol> = T extends any ?
64
64
  [K in Exclude<Ks, keyof T>]?: never;
65
65
  }> : never;
66
66
 
67
+ declare const Permission: {
68
+ /**
69
+ * Default permission for a room.
70
+ */
71
+ readonly Read: "*:read";
72
+ readonly Write: "*:write";
73
+ /**
74
+ * Legacy aliases for default room permissions.
75
+ */
76
+ readonly RoomWrite: "room:write";
77
+ readonly RoomRead: "room:read";
78
+ /**
79
+ * Storage
80
+ */
81
+ readonly StorageRead: "storage:read";
82
+ readonly StorageWrite: "storage:write";
83
+ readonly StorageNone: "storage:none";
84
+ /**
85
+ * Comments
86
+ */
87
+ readonly CommentsWrite: "comments:write";
88
+ readonly CommentsRead: "comments:read";
89
+ readonly CommentsNone: "comments:none";
90
+ /**
91
+ * Feeds
92
+ */
93
+ readonly FeedsRead: "feeds:read";
94
+ readonly FeedsWrite: "feeds:write";
95
+ readonly FeedsNone: "feeds:none";
96
+ /**
97
+ * Legacy
98
+ */
99
+ readonly LegacyRoomPresenceWrite: "room:presence:write";
100
+ };
101
+ type Permission = (typeof Permission)[keyof typeof Permission];
102
+ declare const ACCESS_LEVELS: readonly ["none", "read", "write"];
103
+ type AccessLevel = (typeof ACCESS_LEVELS)[number];
104
+ type RequiredAccessLevel = "read" | "write";
105
+ type PermissionMatrix = {
106
+ room: AccessLevel;
107
+ storage: AccessLevel;
108
+ comments: AccessLevel;
109
+ feeds: AccessLevel;
110
+ personal: AccessLevel;
111
+ };
112
+ type PermissionResources = keyof PermissionMatrix;
113
+ type RoomPermissions = Permission[];
114
+ type RoomAccesses = Record<string, RoomPermissions>;
115
+ type UpdateRoomAccesses = Record<string, RoomPermissions | null>;
116
+ declare function permissionMatrixFromScopes(scopes: RoomPermissions): PermissionMatrix;
117
+ declare function hasPermissionAccess(matrix: Partial<PermissionMatrix>, resource: PermissionResources, requiredAccess: RequiredAccessLevel): boolean;
118
+ declare function normalizeRoomPermissions(permissions: string[] | readonly string[]): RoomPermissions;
119
+ declare function normalizeRoomAccesses(accesses: RoomAccesses | undefined): RoomAccesses | undefined;
120
+ declare function normalizeUpdateRoomAccesses(accesses: UpdateRoomAccesses | undefined): UpdateRoomAccesses | undefined;
121
+ /**
122
+ * Merges permission scopes from multiple sources, by priority: explicit user
123
+ * accesses override group accesses, which override the room defaults. Groups
124
+ * all share the same priority, so they are first merged together by taking
125
+ * the highest access level per feature (and base).
126
+ */
127
+ declare function mergeRoomPermissionScopes({ defaultAccesses, groupsAccesses, userAccesses, }: {
128
+ defaultAccesses: RoomPermissions;
129
+ groupsAccesses: RoomPermissions[];
130
+ userAccesses: RoomPermissions;
131
+ }): RoomPermissions;
132
+ /**
133
+ * Validates a set of permissions:
134
+ * - every scope must be a known permission scope,
135
+ * - exactly one base permission is required (*:read, *:write, or the legacy
136
+ * aliases room:read, room:write),
137
+ * - at most one scope per feature (storage, comments, feeds, ...),
138
+ * - room:presence:write is accepted as an extra legacy scope.
139
+ *
140
+ * Returns `true` when the set is valid, or an error message otherwise.
141
+ */
142
+ declare function validatePermissionsSet(scopes: readonly string[]): true | string;
143
+
67
144
  type CustomAuthenticationResult = Relax<{
68
145
  token: string;
69
146
  } | {
@@ -132,15 +209,6 @@ type BaseUserMeta = {
132
209
  info?: IUserInfo;
133
210
  };
134
211
 
135
- declare enum Permission {
136
- Read = "room:read",
137
- Write = "room:write",
138
- PresenceWrite = "room:presence:write",
139
- CommentsWrite = "comments:write",
140
- CommentsRead = "comments:read",
141
- FeedsWrite = "feeds:write"
142
- }
143
-
144
212
  type RenameDataField<T, TFieldName extends string> = T extends any ? {
145
213
  [K in keyof T as K extends "data" ? TFieldName : K]: T[K];
146
214
  } : never;
@@ -242,90 +310,6 @@ type BatchStore<O, I> = {
242
310
  invalidate: (inputs?: I[]) => void;
243
311
  };
244
312
 
245
- declare const kTrigger: unique symbol;
246
- /**
247
- * Runs a callback function that is allowed to change multiple signals. At the
248
- * end of the batch, all changed signals will be notified (at most once).
249
- *
250
- * Nesting batches is supported.
251
- */
252
- declare function batch(callback: Callback<void>): void;
253
- type SignalType<S extends ISignal<any>> = S extends ISignal<infer T> ? T : never;
254
- interface ISignal<T> {
255
- get(): T;
256
- subscribe(callback: Callback<void>): UnsubscribeCallback;
257
- addSink(sink: DerivedSignal<unknown>): void;
258
- removeSink(sink: DerivedSignal<unknown>): void;
259
- }
260
- /**
261
- * Base functionality every Signal implementation needs.
262
- */
263
- declare abstract class AbstractSignal<T> implements ISignal<T>, Observable<void> {
264
- #private;
265
- constructor(equals?: (a: T, b: T) => boolean);
266
- dispose(): void;
267
- abstract get(): T;
268
- get hasWatchers(): boolean;
269
- [kTrigger](): void;
270
- subscribe(callback: Callback<void>): UnsubscribeCallback;
271
- subscribeOnce(callback: Callback<void>): UnsubscribeCallback;
272
- waitUntil(): never;
273
- markSinksDirty(): void;
274
- addSink(sink: DerivedSignal<unknown>): void;
275
- removeSink(sink: DerivedSignal<unknown>): void;
276
- asReadonly(): ISignal<T>;
277
- }
278
- declare class Signal<T> extends AbstractSignal<T> {
279
- #private;
280
- constructor(value: T, equals?: (a: T, b: T) => boolean);
281
- dispose(): void;
282
- get(): T;
283
- set(newValue: T | ((oldValue: T) => T)): void;
284
- }
285
- declare class DerivedSignal<T> extends AbstractSignal<T> {
286
- #private;
287
- static from<Ts extends unknown[], V>(...args: [...signals: {
288
- [K in keyof Ts]: ISignal<Ts[K]>;
289
- }, transform: (...values: Ts) => V]): DerivedSignal<V>;
290
- static from<Ts extends unknown[], V>(...args: [...signals: {
291
- [K in keyof Ts]: ISignal<Ts[K]>;
292
- }, transform: (...values: Ts) => V, equals: (a: V, b: V) => boolean]): DerivedSignal<V>;
293
- private constructor();
294
- dispose(): void;
295
- get isDirty(): boolean;
296
- markDirty(): void;
297
- get(): T;
298
- /**
299
- * Called by the Signal system if one or more of the dependent signals have
300
- * changed. In the case of a DerivedSignal, we'll only want to re-evaluate
301
- * the actual value if it's being watched, or any of their sinks are being
302
- * watched actively.
303
- */
304
- [kTrigger](): void;
305
- }
306
- /**
307
- * A MutableSignal is a bit like Signal, except its state is managed by
308
- * a single value whose reference does not change but is mutated.
309
- *
310
- * Similar to how useSyncExternalState() works in React, there is a way to read
311
- * the current state at any point in time synchronously, and a way to update
312
- * its reference.
313
- */
314
- declare class MutableSignal<T extends object> extends AbstractSignal<T> {
315
- #private;
316
- constructor(initialState: T);
317
- dispose(): void;
318
- get(): T;
319
- /**
320
- * Invokes a callback function that is allowed to mutate the given state
321
- * value. Do not change the value outside of the callback.
322
- *
323
- * If the callback explicitly returns `false`, it's assumed that the state
324
- * was not changed.
325
- */
326
- mutate(callback?: (state: T) => void | boolean): void;
327
- }
328
-
329
313
  type ContextualPromptResponse = Relax<{
330
314
  type: "insert";
331
315
  text: string;
@@ -427,6 +411,8 @@ declare const OpCode: Readonly<{
427
411
  DELETE_OBJECT_KEY: 6;
428
412
  CREATE_MAP: 7;
429
413
  CREATE_REGISTER: 8;
414
+ CREATE_TEXT: 9;
415
+ UPDATE_TEXT: 10;
430
416
  }>;
431
417
  declare namespace OpCode {
432
418
  type INIT = typeof OpCode.INIT;
@@ -438,13 +424,48 @@ declare namespace OpCode {
438
424
  type DELETE_OBJECT_KEY = typeof OpCode.DELETE_OBJECT_KEY;
439
425
  type CREATE_MAP = typeof OpCode.CREATE_MAP;
440
426
  type CREATE_REGISTER = typeof OpCode.CREATE_REGISTER;
427
+ type CREATE_TEXT = typeof OpCode.CREATE_TEXT;
428
+ type UPDATE_TEXT = typeof OpCode.UPDATE_TEXT;
441
429
  }
430
+ type TextAttributes = JsonObject;
431
+ /**
432
+ * A single segment in a {@link LiveTextData} document.
433
+ *
434
+ * @example
435
+ * ["Hello world"]
436
+ * ["Hello ", { bold: true }]
437
+ */
438
+ type LiveTextSegment = readonly [text: string] | readonly [text: string, attributes: TextAttributes];
439
+ /**
440
+ * Serialized form of a {@link LiveText} document: an ordered list of text
441
+ * segments with optional inline attributes.
442
+ *
443
+ * @example
444
+ * [["Hello world"]]
445
+ * [["Hello ", { bold: true }], ["world"]]
446
+ */
447
+ type LiveTextData = readonly LiveTextSegment[];
448
+ type TextOperation = {
449
+ type: "insert";
450
+ index: number;
451
+ text: string;
452
+ attributes?: TextAttributes;
453
+ } | {
454
+ type: "delete";
455
+ index: number;
456
+ length: number;
457
+ } | {
458
+ type: "format";
459
+ index: number;
460
+ length: number;
461
+ attributes: JsonObject;
462
+ };
442
463
  /**
443
464
  * These operations are the payload for {@link UpdateStorageServerMsg} messages
444
465
  * only.
445
466
  */
446
- type Op = CreateOp | UpdateObjectOp | DeleteCrdtOp | SetParentKeyOp | DeleteObjectKeyOp;
447
- type CreateOp = CreateObjectOp | CreateRegisterOp | CreateMapOp | CreateListOp;
467
+ type Op = CreateOp | UpdateObjectOp | UpdateTextOp | DeleteCrdtOp | SetParentKeyOp | DeleteObjectKeyOp;
468
+ type CreateOp = CreateObjectOp | CreateRegisterOp | CreateMapOp | CreateListOp | CreateTextOp;
448
469
  type UpdateObjectOp = {
449
470
  readonly opId?: string;
450
471
  readonly id: string;
@@ -489,6 +510,26 @@ type CreateRegisterOp = {
489
510
  readonly intent?: "set" | "push";
490
511
  readonly deletedId?: string;
491
512
  };
513
+ type CreateTextOp = {
514
+ readonly opId?: string;
515
+ readonly id: string;
516
+ readonly type: OpCode.CREATE_TEXT;
517
+ readonly parentId: string;
518
+ readonly parentKey: string;
519
+ readonly data: LiveTextData;
520
+ readonly version: number;
521
+ readonly intent?: "set" | "push";
522
+ readonly deletedId?: string;
523
+ };
524
+ type UpdateTextOp = {
525
+ readonly opId?: string;
526
+ readonly id: string;
527
+ readonly type: OpCode.UPDATE_TEXT;
528
+ readonly baseVersion: number;
529
+ readonly version?: number;
530
+ readonly ops: TextOperation[];
531
+ readonly metadata?: JsonObject;
532
+ };
492
533
  type DeleteCrdtOp = {
493
534
  readonly opId?: string;
494
535
  readonly id: string;
@@ -617,15 +658,17 @@ declare const CrdtType: Readonly<{
617
658
  LIST: 1;
618
659
  MAP: 2;
619
660
  REGISTER: 3;
661
+ TEXT: 4;
620
662
  }>;
621
663
  declare namespace CrdtType {
622
664
  type OBJECT = typeof CrdtType.OBJECT;
623
665
  type LIST = typeof CrdtType.LIST;
624
666
  type MAP = typeof CrdtType.MAP;
625
667
  type REGISTER = typeof CrdtType.REGISTER;
668
+ type TEXT = typeof CrdtType.TEXT;
626
669
  }
627
670
  type SerializedCrdt = SerializedRootObject | SerializedChild;
628
- type SerializedChild = SerializedObject | SerializedList | SerializedMap | SerializedRegister;
671
+ type SerializedChild = SerializedObject | SerializedList | SerializedMap | SerializedRegister | SerializedText;
629
672
  type SerializedRootObject = {
630
673
  readonly type: CrdtType.OBJECT;
631
674
  readonly data: JsonObject;
@@ -654,13 +697,21 @@ type SerializedRegister = {
654
697
  readonly parentKey: string;
655
698
  readonly data: Json;
656
699
  };
700
+ type SerializedText = {
701
+ readonly type: CrdtType.TEXT;
702
+ readonly parentId: string;
703
+ readonly parentKey: string;
704
+ readonly data: LiveTextData;
705
+ readonly version: number;
706
+ };
657
707
  type StorageNode = RootStorageNode | ChildStorageNode;
658
- type ChildStorageNode = ObjectStorageNode | ListStorageNode | MapStorageNode | RegisterStorageNode;
708
+ type ChildStorageNode = ObjectStorageNode | ListStorageNode | MapStorageNode | RegisterStorageNode | TextStorageNode;
659
709
  type RootStorageNode = [id: "root", value: SerializedRootObject];
660
710
  type ObjectStorageNode = [id: string, value: SerializedObject];
661
711
  type ListStorageNode = [id: string, value: SerializedList];
662
712
  type MapStorageNode = [id: string, value: SerializedMap];
663
713
  type RegisterStorageNode = [id: string, value: SerializedRegister];
714
+ type TextStorageNode = [id: string, value: SerializedText];
664
715
  type NodeMap = Map<string, SerializedCrdt>;
665
716
  type NodeStream = Iterable<StorageNode>;
666
717
  declare function isRootStorageNode(node: StorageNode): node is RootStorageNode;
@@ -668,8 +719,9 @@ declare function isObjectStorageNode(node: StorageNode): node is RootStorageNode
668
719
  declare function isListStorageNode(node: StorageNode): node is ListStorageNode;
669
720
  declare function isMapStorageNode(node: StorageNode): node is MapStorageNode;
670
721
  declare function isRegisterStorageNode(node: StorageNode): node is RegisterStorageNode;
722
+ declare function isTextStorageNode(node: StorageNode): node is TextStorageNode;
671
723
  type CompactNode = CompactRootNode | CompactChildNode;
672
- type CompactChildNode = CompactObjectNode | CompactListNode | CompactMapNode | CompactRegisterNode;
724
+ type CompactChildNode = CompactObjectNode | CompactListNode | CompactMapNode | CompactRegisterNode | CompactTextNode;
673
725
  type CompactRootNode = readonly [id: "root", data: JsonObject];
674
726
  type CompactObjectNode = readonly [
675
727
  id: string,
@@ -697,6 +749,14 @@ type CompactRegisterNode = readonly [
697
749
  parentKey: string,
698
750
  data: Json
699
751
  ];
752
+ type CompactTextNode = readonly [
753
+ id: string,
754
+ type: CrdtType.TEXT,
755
+ parentId: string,
756
+ parentKey: string,
757
+ data: LiveTextData,
758
+ version: number
759
+ ];
700
760
  declare function compactNodesToNodeStream(compactNodes: CompactNode[]): NodeStream;
701
761
  declare function nodeStreamToCompactNodes(nodes: NodeStream): Iterable<CompactNode>;
702
762
 
@@ -745,6 +805,14 @@ type SyncMode = boolean | "atomic" | SyncConfig;
745
805
  type SyncConfig = {
746
806
  [key: string]: SyncMode | undefined;
747
807
  };
808
+ /**
809
+ * Deeply converts all nested lists to LiveLists, and all nested objects to
810
+ * LiveObjects.
811
+ *
812
+ * As such, the returned result will not contain any Json arrays or Json
813
+ * objects anymore.
814
+ */
815
+ declare function deepLiveify(value: Json, config?: SyncMode): Lson;
748
816
 
749
817
  /**
750
818
  * Optional keys of O whose non-undefined type is plain Json (not a
@@ -854,16 +922,244 @@ declare class LiveObject<O extends LsonObject> extends AbstractCrdt {
854
922
  clone(): LiveObject<O>;
855
923
  }
856
924
 
925
+ /**
926
+ * Use this symbol to brand an object property as internal.
927
+ *
928
+ * @example
929
+ * Object.defineProperty(
930
+ * {
931
+ * public,
932
+ * [kInternal]: {
933
+ * private
934
+ * },
935
+ * },
936
+ * kInternal,
937
+ * {
938
+ * enumerable: false,
939
+ * }
940
+ * );
941
+ */
942
+ declare const kInternal: unique symbol;
943
+ declare const kStorageUpdateSource: unique symbol;
944
+
945
+ /**
946
+ * The position of the ops being transformed relative to the ops they are
947
+ * transformed over, in the final (server-serialized) timeline:
948
+ *
949
+ * - "after": the transformed ops will be ordered after the `over` ops. Used
950
+ * when rebasing a not-yet-accepted op over already-accepted ops. On
951
+ * same-index insert ties, the transformed op shifts right (the earlier op
952
+ * stays left), and conflicting format attributes are kept (they will
953
+ * overwrite, since the op applies later).
954
+ * - "before": the transformed ops were ordered before the `over` ops. Used
955
+ * when applying an accepted remote op on top of locally-pending ops. On
956
+ * same-index insert ties, the transformed op stays left, and conflicting
957
+ * format attributes are dropped on overlapping ranges (the later `over` op
958
+ * wins).
959
+ */
960
+ type TransformOrder = "before" | "after";
961
+ /**
962
+ * Transform `ops` over `over` (see {@link transformTextOperationsX}),
963
+ * returning only the transformed `ops`.
964
+ */
965
+ declare function transformTextOperations(ops: readonly TextOperation[], over: readonly TextOperation[], order: TransformOrder): TextOperation[];
966
+ declare function applyLiveTextOperations(data: LiveTextData, ops: readonly TextOperation[]): LiveTextData;
967
+
968
+ type LiveTextAttributes = TextAttributes;
969
+ type LiveTextAttributesPatch = JsonObject;
970
+
971
+ type LiveTextChange = {
972
+ /** Text was inserted at {@link LiveTextChange.index}. */
973
+ readonly type: "insert";
974
+ readonly index: number;
975
+ readonly text: string;
976
+ readonly attributes?: TextAttributes;
977
+ } | {
978
+ /** Text was deleted starting at {@link LiveTextChange.index}. */
979
+ readonly type: "delete";
980
+ readonly index: number;
981
+ readonly length: number;
982
+ readonly deletedText: string;
983
+ } | {
984
+ /** Inline attributes were updated on a range of text. */
985
+ readonly type: "format";
986
+ readonly index: number;
987
+ readonly length: number;
988
+ readonly attributes: LiveTextAttributesPatch;
989
+ };
990
+ /** Notification payload when a {@link LiveText} node changes. */
991
+ type LiveTextUpdates = {
992
+ type: "LiveText";
993
+ node: LiveText;
994
+ version: number;
995
+ updates: LiveTextChange[];
996
+ };
997
+ /**
998
+ * @private
999
+ *
1000
+ * Private methods on a LiveText node. As a user of Liveblocks, NEVER USE ANY
1001
+ * OF THESE DIRECTLY, because bad things will probably happen if you do.
1002
+ */
1003
+ type PrivateLiveTextApi = {
1004
+ /**
1005
+ * Encode a local-document index into server-confirmed coordinates suitable
1006
+ * for broadcasting to peers via presence or any other side channel. Pair
1007
+ * the result with {@link LiveText.version} at the same instant when
1008
+ * sending.
1009
+ */
1010
+ encodeIndex(localIndex: number): number;
1011
+ /**
1012
+ * Decode an `(index, fromVersion)` pair from a peer into an offset in this
1013
+ * LiveText's current local document.
1014
+ */
1015
+ decodeIndex(index: number, fromVersion: number): number | null;
1016
+ };
1017
+
1018
+ /**
1019
+ * LiveText is a collaborative rich-text primitive built on server-ordered
1020
+ * operational transformation.
1021
+ *
1022
+ * Use it to store plain text with optional inline formatting attributes in
1023
+ * Liveblocks Storage. Each document is a flat sequence of text segments; it
1024
+ * cannot contain child Storage structures.
1025
+ *
1026
+ * Outbound model (one-in-flight): at most one UpdateTextOp per node is
1027
+ * awaiting server acknowledgement at any time. Local edits made while an op
1028
+ * is in flight are queued and sent (composed into a single op) once the ack
1029
+ * arrives. This guarantees every wire op is expressed against server-state
1030
+ * coordinates, so the server can transform it over exactly the (foreign)
1031
+ * ops the client hadn't seen — never over the client's own pending ops.
1032
+ *
1033
+ * Inbound model: accepted remote ops are transformed over the local pending
1034
+ * ops before being applied ("before" order: the accepted op wins ties), and
1035
+ * the pending ops are re-expressed over the remote op in turn ("after"
1036
+ * order), keeping them in server coordinates at all times.
1037
+ *
1038
+ * @example
1039
+ * const text = new LiveText("Hello");
1040
+ * text.insert(5, " world");
1041
+ * text.format(0, 5, { bold: true });
1042
+ *
1043
+ * // [["Hello", { bold: true }], [" world"]]
1044
+ * text.toJSON();
1045
+ *
1046
+ * @example
1047
+ * // Use in Storage
1048
+ * declare global {
1049
+ * interface Liveblocks {
1050
+ * Storage: { document: LiveText };
1051
+ * }
1052
+ * }
1053
+ *
1054
+ * const { root } = await room.getStorage();
1055
+ * root.get("document").replace(0, root.get("document").length, "Updated");
1056
+ */
1057
+ declare class LiveText extends AbstractCrdt {
1058
+ #private;
1059
+ /**
1060
+ * @private
1061
+ *
1062
+ * Private methods and variables used in the core internals, but as a user
1063
+ * of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
1064
+ * will probably happen if you do.
1065
+ */
1066
+ readonly [kInternal]: PrivateLiveTextApi;
1067
+ /**
1068
+ * Creates a new LiveText document.
1069
+ *
1070
+ * @param textOrData Initial plain text, or an array of `[text]` /
1071
+ * `[text, attributes]` segments. Defaults to an empty document.
1072
+ *
1073
+ * @example
1074
+ * new LiveText();
1075
+ * new LiveText("Hello world");
1076
+ * new LiveText([["Hello ", { bold: true }], ["world"]]);
1077
+ */
1078
+ constructor(textOrData?: string | LiveTextData, version?: number);
1079
+ get version(): number;
1080
+ get length(): number;
1081
+ /**
1082
+ * Inserts text at the given index.
1083
+ *
1084
+ * @param index Character index at which to insert. Values outside the
1085
+ * document range are clipped.
1086
+ * @param text Text to insert.
1087
+ * @param attributes Optional inline attributes for the inserted text.
1088
+ *
1089
+ * @example
1090
+ * const text = new LiveText("Hello");
1091
+ * text.insert(5, " world");
1092
+ * text.insert(0, "Say: ", { italic: true });
1093
+ */
1094
+ insert(index: number, text: string, attributes?: TextAttributes): void;
1095
+ /**
1096
+ * Deletes `length` characters starting at `index`.
1097
+ *
1098
+ * @example
1099
+ * const text = new LiveText("Hello world");
1100
+ * text.delete(5, 6); // "Hello"
1101
+ */
1102
+ delete(index: number, length: number): void;
1103
+ /**
1104
+ * Replaces a range of text with new text.
1105
+ *
1106
+ * @example
1107
+ * const text = new LiveText("Hello world");
1108
+ * text.replace(0, 5, "Hi"); // "Hi world"
1109
+ */
1110
+ replace(index: number, length: number, text: string, attributes?: TextAttributes): void;
1111
+ /**
1112
+ * Applies or removes inline attributes on a range of text.
1113
+ *
1114
+ * Set an attribute to `null` to remove it from the range.
1115
+ *
1116
+ * @example
1117
+ * const text = new LiveText("Hello world");
1118
+ * text.format(0, 5, { bold: true });
1119
+ * text.format(0, 5, { bold: null });
1120
+ */
1121
+ format(index: number, length: number, attributes: LiveTextAttributesPatch): void;
1122
+ /** Returns the plain text content without attributes. Equivalent to joining the text from each segment in {@link LiveText.toJSON}. */
1123
+ toString(): string;
1124
+ /**
1125
+ * Returns a JSON-compatible snapshot of the document as a {@link LiveTextData}
1126
+ * array.
1127
+ *
1128
+ * @example
1129
+ * new LiveText([["Hello ", { bold: true }], ["world"]]).toJSON();
1130
+ * // [["Hello ", { bold: true }], ["world"]]
1131
+ */
1132
+ toJSON(): LiveTextData;
1133
+ clone(): LiveText;
1134
+ }
1135
+
857
1136
  type StorageCallback = (updates: StorageUpdate[]) => void;
858
1137
  type LiveMapUpdate = LiveMapUpdates<string, Lson>;
859
1138
  type LiveObjectUpdate = LiveObjectUpdates<LsonObject>;
860
1139
  type LiveListUpdate = LiveListUpdates<Lson>;
1140
+ type LiveTextUpdate = LiveTextUpdates;
1141
+ type StorageUpdateSource = {
1142
+ origin: "remote";
1143
+ } | {
1144
+ origin: "local";
1145
+ via: "mutation";
1146
+ } | {
1147
+ origin: "local";
1148
+ via: "history";
1149
+ action: "undo" | "redo";
1150
+ };
861
1151
  /**
862
1152
  * The payload of notifications sent (in-client) when LiveStructures change.
863
1153
  * Messages of this kind are not originating from the network, but are 100%
864
1154
  * in-client.
1155
+ *
1156
+ * Updates delivered through `room.subscribe` may carry
1157
+ * `[kStorageUpdateSource]` to distinguish where a mutation came from.
1158
+ * Undo/redo replays use `via: "history"` with `action: "undo" | "redo"`.
865
1159
  */
866
- type StorageUpdate = LiveMapUpdate | LiveObjectUpdate | LiveListUpdate;
1160
+ type StorageUpdate = (LiveMapUpdate | LiveObjectUpdate | LiveListUpdate | LiveTextUpdate) & {
1161
+ [kStorageUpdateSource]?: StorageUpdateSource;
1162
+ };
867
1163
 
868
1164
  /**
869
1165
  * Read-only query surface over {@link UnacknowledgedOps}, handed to CRDTs so
@@ -878,8 +1174,27 @@ interface ReadonlyUnacknowledgedOps {
878
1174
  * the given ones (i.e. targeting one exact position).
879
1175
  */
880
1176
  getByParentIdAndKey(parentId: string, parentKey: string): Iterable<ClientWireCreateOp>;
1177
+ /**
1178
+ * Whether the given pending op may already have been processed by the
1179
+ * server. True for ops that were in flight when a connection died: the
1180
+ * server may have stored them with the ack getting lost in the disconnect,
1181
+ * or may never have received them. Until the (re-sent) op's ack arrives,
1182
+ * the client cannot know which, so optimistic predictions that assume the
1183
+ * op has not been processed yet are unsound for these ops.
1184
+ */
1185
+ isPossiblyStored(opId: string): boolean;
881
1186
  }
882
1187
 
1188
+ type DispatchOptions = {
1189
+ /**
1190
+ * Whether this dispatch should clear the redo stack. Defaults to true when
1191
+ * any forward ops are included (a fresh local mutation), false otherwise.
1192
+ * LiveText uses this to dispatch queued ops after an acknowledgement
1193
+ * (which should not clear redo), and to register fresh local edits that
1194
+ * don't carry wire ops yet (which should).
1195
+ */
1196
+ clearRedoStack?: boolean;
1197
+ };
883
1198
  /**
884
1199
  * The managed pool is a namespace registry (i.e. a context) that "owns" all
885
1200
  * the individual live nodes, ensuring each one has a unique ID, and holding on
@@ -899,7 +1214,7 @@ interface ManagedPool {
899
1214
  * - Add reverse operations to the undo/redo stack
900
1215
  * - Notify room subscribers with updates (in-client, no networking)
901
1216
  */
902
- dispatch: (ops: ClientWireOp[], reverseOps: Op[], storageUpdates: Map<string, StorageUpdate>) => void;
1217
+ dispatch: (ops: ClientWireOp[], reverseOps: Op[], storageUpdates: Map<string, StorageUpdate>, options?: DispatchOptions) => void;
903
1218
  /**
904
1219
  * Ensures storage can be written to else throws an error.
905
1220
  * This is used to prevent writing to storage when the user does not have
@@ -924,7 +1239,7 @@ type CreateManagedPoolOptions = {
924
1239
  /**
925
1240
  * Will get invoked when any Live structure calls .dispatch() on the pool.
926
1241
  */
927
- onDispatch?: (ops: ClientWireOp[], reverse: Op[], storageUpdates: Map<string, StorageUpdate>) => void;
1242
+ onDispatch?: (ops: ClientWireOp[], reverse: Op[], storageUpdates: Map<string, StorageUpdate>, options?: DispatchOptions) => void;
928
1243
  /**
929
1244
  * Will get invoked when any Live structure calls .assertStorageIsWritable()
930
1245
  * on the pool. Defaults to true when not provided. Return false if you want
@@ -1104,7 +1419,7 @@ declare class LiveRegister<TValue extends Json> extends AbstractCrdt {
1104
1419
  clone(): TValue;
1105
1420
  }
1106
1421
 
1107
- type LiveStructure = LiveObject<LsonObject> | LiveList<Lson> | LiveMap<string, Lson>;
1422
+ type LiveStructure = LiveObject<LsonObject> | LiveList<Lson> | LiveMap<string, Lson> | LiveText;
1108
1423
  /**
1109
1424
  * Think of Lson as a sibling of the Json data tree, except that the nested
1110
1425
  * data structure can contain a mix of Json values and LiveStructure instances.
@@ -1140,7 +1455,7 @@ type ToJson<L extends Lson | LsonObject> = L extends LiveList<infer I extends Ls
1140
1455
  readonly [K in keyof O]: ToJson<Exclude<O[K], undefined>> | (undefined extends O[K] ? undefined : never);
1141
1456
  } : L extends LiveMap<infer KS extends string, infer V extends Lson> ? Lson extends V ? ReadonlyJsonObject : {
1142
1457
  readonly [K in KS]: ToJson<V>;
1143
- } : L extends LsonObject ? string extends keyof L ? ReadonlyJsonObject : {
1458
+ } : L extends LiveText ? LiveTextData : L extends LsonObject ? string extends keyof L ? ReadonlyJsonObject : {
1144
1459
  readonly [K in keyof L]: ToJson<Exclude<L[K], undefined>> | (undefined extends L[K] ? undefined : never);
1145
1460
  } : L extends Json ? L : never;
1146
1461
 
@@ -1677,7 +1992,7 @@ interface RoomHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> {
1677
1992
  subscriptions: SubscriptionData[];
1678
1993
  requestedAt: Date;
1679
1994
  nextCursor: string | null;
1680
- permissionHints: Record<string, Permission[]>;
1995
+ permissionHints: Record<string, RoomPermissions>;
1681
1996
  }>;
1682
1997
  getThreadsSince(options: {
1683
1998
  roomId: string;
@@ -1697,7 +2012,7 @@ interface RoomHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> {
1697
2012
  deleted: SubscriptionDeleteInfo[];
1698
2013
  };
1699
2014
  requestedAt: Date;
1700
- permissionHints: Record<string, Permission[]>;
2015
+ permissionHints: Record<string, RoomPermissions>;
1701
2016
  }>;
1702
2017
  searchComments(options: {
1703
2018
  roomId: string;
@@ -1816,18 +2131,6 @@ interface RoomHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> {
1816
2131
  signal?: AbortSignal;
1817
2132
  }): Promise<CommentAttachment>;
1818
2133
  getOrCreateAttachmentUrlsStore(roomId: string): BatchStore<string, string>;
1819
- uploadChatAttachment({ chatId, attachment, signal, }: {
1820
- chatId: string;
1821
- attachment: {
1822
- id: string;
1823
- file: File;
1824
- };
1825
- signal?: AbortSignal;
1826
- }): Promise<void>;
1827
- getOrCreateChatAttachmentUrlsStore(chatId: string): BatchStore<string, string>;
1828
- getChatAttachmentUrl(options: {
1829
- attachmentId: string;
1830
- }): Promise<string>;
1831
2134
  createTextMention({ roomId, mentionId, mention, }: {
1832
2135
  roomId: string;
1833
2136
  mentionId: string;
@@ -1959,7 +2262,7 @@ interface LiveblocksHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> ex
1959
2262
  subscriptions: SubscriptionData[];
1960
2263
  nextCursor: string | null;
1961
2264
  requestedAt: Date;
1962
- permissionHints: Record<string, Permission[]>;
2265
+ permissionHints: Record<string, RoomPermissions>;
1963
2266
  }>;
1964
2267
  getUserThreadsSince_experimental(options: {
1965
2268
  since: Date;
@@ -1978,37 +2281,102 @@ interface LiveblocksHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> ex
1978
2281
  deleted: SubscriptionDeleteInfo[];
1979
2282
  };
1980
2283
  requestedAt: Date;
1981
- permissionHints: Record<string, Permission[]>;
2284
+ permissionHints: Record<string, RoomPermissions>;
1982
2285
  }>;
1983
2286
  groupsStore: BatchStore<GroupData | undefined, string>;
1984
2287
  getGroup(groupId: string): Promise<GroupData | undefined>;
1985
2288
  }
1986
2289
 
1987
- /**
1988
- * Use this symbol to brand an object property as internal.
1989
- *
1990
- * @example
1991
- * Object.defineProperty(
1992
- * {
1993
- * public,
1994
- * [kInternal]: {
1995
- * private
1996
- * },
1997
- * },
1998
- * kInternal,
1999
- * {
2000
- * enumerable: false,
2001
- * }
2002
- * );
2003
- */
2004
- declare const kInternal: unique symbol;
2005
-
2006
2290
  /**
2007
2291
  * Back-port of TypeScript 5.4's built-in NoInfer utility type.
2008
2292
  * See https://stackoverflow.com/a/56688073/148872
2009
2293
  */
2010
2294
  type NoInfr<A> = [A][A extends any ? 0 : never];
2011
2295
 
2296
+ declare const kTrigger: unique symbol;
2297
+ /**
2298
+ * Runs a callback function that is allowed to change multiple signals. At the
2299
+ * end of the batch, all changed signals will be notified (at most once).
2300
+ *
2301
+ * Nesting batches is supported.
2302
+ */
2303
+ declare function batch(callback: Callback<void>): void;
2304
+ type SignalType<S extends ISignal<any>> = S extends ISignal<infer T> ? T : never;
2305
+ interface ISignal<T> {
2306
+ get(): T;
2307
+ subscribe(callback: Callback<void>): UnsubscribeCallback;
2308
+ addSink(sink: DerivedSignal<unknown>): void;
2309
+ removeSink(sink: DerivedSignal<unknown>): void;
2310
+ }
2311
+ /**
2312
+ * Base functionality every Signal implementation needs.
2313
+ */
2314
+ declare abstract class AbstractSignal<T> implements ISignal<T>, Observable<void> {
2315
+ #private;
2316
+ constructor(equals?: (a: T, b: T) => boolean);
2317
+ dispose(): void;
2318
+ abstract get(): T;
2319
+ get hasWatchers(): boolean;
2320
+ [kTrigger](): void;
2321
+ subscribe(callback: Callback<void>): UnsubscribeCallback;
2322
+ subscribeOnce(callback: Callback<void>): UnsubscribeCallback;
2323
+ waitUntil(): never;
2324
+ markSinksDirty(): void;
2325
+ addSink(sink: DerivedSignal<unknown>): void;
2326
+ removeSink(sink: DerivedSignal<unknown>): void;
2327
+ asReadonly(): ISignal<T>;
2328
+ }
2329
+ declare class Signal<T> extends AbstractSignal<T> {
2330
+ #private;
2331
+ constructor(value: T, equals?: (a: T, b: T) => boolean);
2332
+ dispose(): void;
2333
+ get(): T;
2334
+ set(newValue: T | ((oldValue: T) => T)): void;
2335
+ }
2336
+ declare class DerivedSignal<T> extends AbstractSignal<T> {
2337
+ #private;
2338
+ static from<Ts extends unknown[], V>(...args: [...signals: {
2339
+ [K in keyof Ts]: ISignal<Ts[K]>;
2340
+ }, transform: (...values: Ts) => V]): DerivedSignal<V>;
2341
+ static from<Ts extends unknown[], V>(...args: [...signals: {
2342
+ [K in keyof Ts]: ISignal<Ts[K]>;
2343
+ }, transform: (...values: Ts) => V, equals: (a: V, b: V) => boolean]): DerivedSignal<V>;
2344
+ private constructor();
2345
+ dispose(): void;
2346
+ get isDirty(): boolean;
2347
+ markDirty(): void;
2348
+ get(): T;
2349
+ /**
2350
+ * Called by the Signal system if one or more of the dependent signals have
2351
+ * changed. In the case of a DerivedSignal, we'll only want to re-evaluate
2352
+ * the actual value if it's being watched, or any of their sinks are being
2353
+ * watched actively.
2354
+ */
2355
+ [kTrigger](): void;
2356
+ }
2357
+ /**
2358
+ * A MutableSignal is a bit like Signal, except its state is managed by
2359
+ * a single value whose reference does not change but is mutated.
2360
+ *
2361
+ * Similar to how useSyncExternalState() works in React, there is a way to read
2362
+ * the current state at any point in time synchronously, and a way to update
2363
+ * its reference.
2364
+ */
2365
+ declare class MutableSignal<T extends object> extends AbstractSignal<T> {
2366
+ #private;
2367
+ constructor(initialState: T);
2368
+ dispose(): void;
2369
+ get(): T;
2370
+ /**
2371
+ * Invokes a callback function that is allowed to mutate the given state
2372
+ * value. Do not change the value outside of the callback.
2373
+ *
2374
+ * If the callback explicitly returns `false`, it's assumed that the state
2375
+ * was not changed.
2376
+ */
2377
+ mutate(callback?: (state: T) => void | boolean): void;
2378
+ }
2379
+
2012
2380
  type Awaitable<T> = T | PromiseLike<T>;
2013
2381
 
2014
2382
  type AiConnectionErrorContext = {
@@ -2140,11 +2508,6 @@ type EnterOptions<P extends JsonObject = DP, S extends LsonObject = DS> = Resolv
2140
2508
  * the authentication endpoint or connect via WebSocket.
2141
2509
  */
2142
2510
  autoConnect?: boolean;
2143
- /**
2144
- * @deprecated This flag no longer has any effect and will be removed in
2145
- * a future version. All rooms now use the v2 storage engine by default.
2146
- */
2147
- engine?: 1 | 2;
2148
2511
  } & PartialUnless<P, {
2149
2512
  /**
2150
2513
  * The initial Presence to use and announce when you enter the Room. The
@@ -2452,12 +2815,6 @@ type ClientOptions<U extends BaseUserMeta = DU> = {
2452
2815
  lostConnectionTimeout?: number;
2453
2816
  backgroundKeepAliveTimeout?: number;
2454
2817
  polyfills?: Polyfills;
2455
- /**
2456
- * @deprecated All rooms will be migrated to the v2 storage engine in the
2457
- * future, which has native support for streaming. After that migration, this
2458
- * flag will no longer have any effect and will be removed in a future version.
2459
- */
2460
- unstable_streamData?: boolean;
2461
2818
  /**
2462
2819
  * A function that returns a list of mention suggestions matching a string.
2463
2820
  */
@@ -3667,10 +4024,15 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
3667
4024
  }>;
3668
4025
  /**
3669
4026
  * Get the room's storage synchronously.
3670
- * The storage's root is a {@link LiveObject}.
4027
+ * The storage's root is a LiveObject.
3671
4028
  *
3672
4029
  * @example
3673
- * const root = room.getStorageSnapshot();
4030
+ * const root = room.getStorageOrNull();
4031
+ */
4032
+ getStorageOrNull(): LiveObject<S> | null;
4033
+ /**
4034
+ * @deprecated Renamed to `Room.getStorageOrNull`. This alias will be
4035
+ * removed in the future.
3674
4036
  */
3675
4037
  getStorageSnapshot(): LiveObject<S> | null;
3676
4038
  /**
@@ -3787,7 +4149,7 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
3787
4149
  subscriptions: SubscriptionData[];
3788
4150
  requestedAt: Date;
3789
4151
  nextCursor: string | null;
3790
- permissionHints: Record<string, Permission[]>;
4152
+ permissionHints: Record<string, RoomPermissions>;
3791
4153
  }>;
3792
4154
  /**
3793
4155
  * Returns the updated and deleted threads and their associated inbox notifications and subscriptions since the requested date.
@@ -3811,7 +4173,7 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
3811
4173
  deleted: SubscriptionDeleteInfo[];
3812
4174
  };
3813
4175
  requestedAt: Date;
3814
- permissionHints: Record<string, Permission[]>;
4176
+ permissionHints: Record<string, RoomPermissions>;
3815
4177
  }>;
3816
4178
  /**
3817
4179
  * Returns a thread and the associated inbox notification and subscription if it exists.
@@ -4055,7 +4417,14 @@ interface SyncSource {
4055
4417
  */
4056
4418
  type PrivateRoomApi = {
4057
4419
  presenceBuffer: Json | undefined;
4058
- undoStack: readonly (readonly Readonly<Stackframe<JsonObject>>[])[];
4420
+ undoStack: readonly {
4421
+ readonly id: number;
4422
+ readonly frames: readonly Readonly<Stackframe<JsonObject>>[];
4423
+ }[];
4424
+ redoStack: readonly {
4425
+ readonly id: number;
4426
+ readonly frames: readonly Readonly<Stackframe<JsonObject>>[];
4427
+ }[];
4059
4428
  nodeCount: number;
4060
4429
  getYjsProvider(): IYjsProvider | undefined;
4061
4430
  setYjsProvider(provider: IYjsProvider | undefined): void;
@@ -4090,6 +4459,21 @@ type PrivateRoomApi = {
4090
4459
  incomingMessage(data: string): void;
4091
4460
  };
4092
4461
  attachmentUrlsStore: BatchStore<string, string>;
4462
+ readonly history: Observable<{
4463
+ action: "push";
4464
+ id: number;
4465
+ } | {
4466
+ action: "undo";
4467
+ id: number;
4468
+ } | {
4469
+ action: "redo";
4470
+ id: number;
4471
+ } | {
4472
+ action: "clear";
4473
+ } | {
4474
+ action: "discard";
4475
+ ids: number[];
4476
+ }>;
4093
4477
  };
4094
4478
  type Stackframe<P extends JsonObject> = Op | PresenceStackframe<P>;
4095
4479
  type PresenceStackframe<P extends JsonObject> = {
@@ -4103,7 +4487,7 @@ type StaticSessionInfo = {
4103
4487
  type DynamicSessionInfo = {
4104
4488
  readonly actor: number;
4105
4489
  readonly nonce: string;
4106
- readonly scopes: string[];
4490
+ readonly permissionMatrix: PermissionMatrix;
4107
4491
  readonly meta: JsonObject;
4108
4492
  };
4109
4493
  type Polyfills = {
@@ -4989,7 +5373,12 @@ type PlainLsonList = {
4989
5373
  liveblocksType: "LiveList";
4990
5374
  data: PlainLson[];
4991
5375
  };
4992
- type PlainLson = PlainLsonObject | PlainLsonMap | PlainLsonList | Json;
5376
+ type PlainLsonText = {
5377
+ liveblocksType: "LiveText";
5378
+ data: LiveTextData;
5379
+ version?: number;
5380
+ };
5381
+ type PlainLson = PlainLsonObject | PlainLsonMap | PlainLsonList | PlainLsonText | Json;
4993
5382
 
4994
5383
  /**
4995
5384
  * Returns PlainLson for a given Json or LiveStructure, suitable for calling the storage init api
@@ -5704,4 +6093,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
5704
6093
  [K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
5705
6094
  };
5706
6095
 
5707
- export { type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeRetrievalPart, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiRetrievalPart, type AiSourcesPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUrlSource, type AiUserMessage, type AiWebRetrievalPart, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, type BaseGroupInfo, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type ChildStorageNode, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type ClientWireOp, 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, type CommentsEventServerMsg, type CompactChildNode, type CompactListNode, type CompactMapNode, type CompactNode, type CompactObjectNode, type CompactRegisterNode, type CompactRootNode, type ContextualPromptContext, type ContextualPromptResponse, type CopilotId, CrdtType, type CreateListOp, type CreateManagedPoolOptions, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type Cursor, type CustomAuthenticationResult, type DAD, type DCM, type DE, type DFM, type DFMD, type DGI, type DP, type DRI, type DS, type DTM, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, Deque, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type Feed, type FeedCreateMetadata, type FeedDeletedServerMsg, type FeedFetchMetadataFilter, type FeedMessage, type FeedMessagesAddedServerMsg, type FeedMessagesDeletedServerMsg, type FeedMessagesListServerMsg, type FeedMessagesUpdatedServerMsg, type FeedRequestError, FeedRequestErrorCode, type FeedRequestFailedServerMsg, type FeedUpdateMetadata, type FeedsAddedServerMsg, type FeedsEventServerMsg, type FeedsListServerMsg, type FeedsUpdatedServerMsg, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type GroupData, type GroupDataPlain, type GroupMemberData, type GroupMentionData, type GroupScopes, type HasOpId, type History, type HistoryVersion, HttpError, type ISODateString, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IgnoredOp, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InferFromSchema, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, type LayerKey, type ListStorageNode, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MENTION_CHARACTER, type ManagedPool, type MapStorageNode, type MentionData, type MessageId, MutableSignal, type NoInfr, type NodeMap, type NodeStream, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, type ObjectStorageNode, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialNotificationSettings, 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 ReadonlyJson, type ReadonlyJsonObject, type RegisterStorageNode, type RejectedStorageOpServerMsg, type Relax, type RenderableToolResultResponse, type Resolve, type ResolveGroupsInfoArgs, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomStateServerMsg, type RoomSubscriptionSettings, type RootStorageNode, type SearchCommentsResult, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type ServerWireOp, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageChunkServerMsg, type StorageNode, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SubscriptionData, type SubscriptionDataPlain, type SubscriptionDeleteInfo, type SubscriptionDeleteInfoPlain, type SubscriptionKey, type SyncConfig, type SyncMode, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToJson, type ToolResultResponse, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type UrlMetadata, type User, type UserJoinServerMsg, type UserLeftServerMsg, type UserMentionData, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, type WithNavigation, type WithOptional, type WithRequired, type YDocUpdateServerMsg, type YjsSyncStatus, asPos, assert, assertNever, autoRetry, b64decode, batch, checkBounds, chunk, cloneLson, compactNodesToNodeStream, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToGroupData, convertToInboxNotificationData, convertToSubscriptionData, convertToThreadData, convertToUserSubscriptionData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createManagedPool, createNotificationSettings, createThreadId, defineAiTool, deprecate, deprecateIf, detectDupes, entries, errorIf, findLastIndex, freeze, generateUrl, getMentionsFromCommentBody, getSubscriptionKey, html, htmlSafe, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isListStorageNode, isLiveNode, isMapStorageNode, isNotificationChannelEnabled, isNumberOperator, isObjectStorageNode, isPlainObject, isRegisterStorageNode, isRootStorageNode, isStartsWithOperator, isUrl, kInternal, keys, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, nodeStreamToCompactNodes, objectToQuery, patchNotificationSettings, raise, resolveMentionsInCommentBody, sanitizeUrl, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, url, urljoin, wait, warnOnce, warnOnceIf, withTimeout };
6096
+ export { type AccessLevel, type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeRetrievalPart, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiRetrievalPart, type AiSourcesPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUrlSource, type AiUserMessage, type AiWebRetrievalPart, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, type BaseGroupInfo, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type ChildStorageNode, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type ClientWireOp, 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, type CommentsEventServerMsg, type CompactChildNode, type CompactListNode, type CompactMapNode, type CompactNode, type CompactObjectNode, type CompactRegisterNode, type CompactRootNode, type CompactTextNode, type ContextualPromptContext, type ContextualPromptResponse, type CopilotId, CrdtType, type CreateListOp, type CreateManagedPoolOptions, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CreateTextOp, type Cursor, type CustomAuthenticationResult, type DAD, type DCM, type DE, type DFM, type DFMD, type DGI, type DP, type DRI, type DS, type DTM, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, Deque, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type Feed, type FeedCreateMetadata, type FeedDeletedServerMsg, type FeedFetchMetadataFilter, type FeedMessage, type FeedMessagesAddedServerMsg, type FeedMessagesDeletedServerMsg, type FeedMessagesListServerMsg, type FeedMessagesUpdatedServerMsg, type FeedRequestError, FeedRequestErrorCode, type FeedRequestFailedServerMsg, type FeedUpdateMetadata, type FeedsAddedServerMsg, type FeedsEventServerMsg, type FeedsListServerMsg, type FeedsUpdatedServerMsg, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type GroupData, type GroupDataPlain, type GroupMemberData, type GroupMentionData, type GroupScopes, type HasOpId, type History, type HistoryVersion, HttpError, type ISODateString, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IgnoredOp, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InferFromSchema, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, type LayerKey, type ListStorageNode, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveText, type LiveTextAttributes, type LiveTextAttributesPatch, type LiveTextChange, type LiveTextData, type TextOperation as LiveTextOperation, type LiveTextSegment, type LiveTextUpdate, type LiveTextUpdates, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MENTION_CHARACTER, type ManagedPool, type MapStorageNode, type MentionData, type MessageId, MutableSignal, type NoInfr, type NodeMap, type NodeStream, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, type ObjectStorageNode, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialNotificationSettings, type PartialUnless, type Patchable, Permission, type PermissionMatrix, type PermissionResources, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type PlainLsonText, type Poller, type PrivateClientApi, type PrivateLiveTextApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type ReadonlyJson, type ReadonlyJsonObject, type RegisterStorageNode, type RejectedStorageOpServerMsg, type Relax, type RenderableToolResultResponse, type RequiredAccessLevel, type Resolve, type ResolveGroupsInfoArgs, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomAccesses, type RoomEventMessage, type RoomPermissions, type RoomStateServerMsg, type RoomSubscriptionSettings, type RootStorageNode, type SearchCommentsResult, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type SerializedText, type ServerMsg, ServerMsgCode, type ServerWireOp, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageChunkServerMsg, type StorageNode, type StorageStatus, type StorageUpdate, type StorageUpdateSource, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SubscriptionData, type SubscriptionDataPlain, type SubscriptionDeleteInfo, type SubscriptionDeleteInfoPlain, type SubscriptionKey, type SyncConfig, type SyncMode, type SyncSource, type SyncStatus, type TextAttributes, TextEditorType, type TextOperation, type TextStorageNode, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToJson, type ToolResultResponse, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateRoomAccesses, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateTextOp, type UpdateYDocClientMsg, type UploadAttachmentOptions, type UrlMetadata, type User, type UserJoinServerMsg, type UserLeftServerMsg, type UserMentionData, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, type WithNavigation, type WithOptional, type WithRequired, type YDocUpdateServerMsg, type YjsSyncStatus, applyLiveTextOperations, asPos, assert, assertNever, autoRetry, b64decode, batch, checkBounds, chunk, cloneLson, compactNodesToNodeStream, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToGroupData, convertToInboxNotificationData, convertToSubscriptionData, convertToThreadData, convertToUserSubscriptionData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createManagedPool, createNotificationSettings, createThreadId, deepLiveify, defineAiTool, deprecate, deprecateIf, detectDupes, entries, errorIf, findLastIndex, freeze, generateUrl, getMentionsFromCommentBody, getSubscriptionKey, hasPermissionAccess, html, htmlSafe, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isListStorageNode, isLiveNode, isMapStorageNode, isNotificationChannelEnabled, isNumberOperator, isObjectStorageNode, isPlainObject, isRegisterStorageNode, isRootStorageNode, isStartsWithOperator, isTextStorageNode, isUrl, kInternal, kStorageUpdateSource, keys, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, mergeRoomPermissionScopes, nanoid, nn, nodeStreamToCompactNodes, normalizeRoomAccesses, normalizeRoomPermissions, normalizeUpdateRoomAccesses, objectToQuery, patchNotificationSettings, permissionMatrixFromScopes, raise, resolveMentionsInCommentBody, sanitizeUrl, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toPlainLson, transformTextOperations, tryParseJson, url, urljoin, validatePermissionsSet, wait, warnOnce, warnOnceIf, withTimeout };