@liveblocks/core 3.2.1 → 3.3.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.cts CHANGED
@@ -3450,6 +3450,12 @@ type Brand<T, TBrand extends string> = T & {
3450
3450
  [brand]: TBrand;
3451
3451
  };
3452
3452
  type DistributiveOmit<T, K extends PropertyKey> = T extends any ? Omit<T, K> : never;
3453
+ type WithRequired<T, K extends keyof T> = T & {
3454
+ [P in K]-?: T[P];
3455
+ };
3456
+ type WithOptional<T, K extends keyof T> = Omit<T, K> & {
3457
+ [P in K]?: T[P];
3458
+ };
3453
3459
  /**
3454
3460
  * Throw an error, but as an expression instead of a statement.
3455
3461
  */
@@ -3538,6 +3544,9 @@ type AbortAiResponse = ServerCmdResponse<AbortAiPair>;
3538
3544
  type GetChatsPair = DefineCmd<"get-chats", {
3539
3545
  cursor?: Cursor;
3540
3546
  pageSize?: number;
3547
+ query?: {
3548
+ metadata?: Record<string, string | string[] | null>;
3549
+ };
3541
3550
  }, {
3542
3551
  chats: AiChat[];
3543
3552
  nextCursor: Cursor | null;
@@ -3548,6 +3557,28 @@ type CreateChatOptions = {
3548
3557
  /** Arbitrary metadata to record for this chat. This can be later used to filter the list of chats by metadata. */
3549
3558
  metadata?: Record<string, string | string[]>;
3550
3559
  };
3560
+ type AiChatsQuery = {
3561
+ metadata?: Record<string, string | string[] | null>;
3562
+ };
3563
+ type GetChatsOptions = {
3564
+ /**
3565
+ * The cursor to use for pagination.
3566
+ */
3567
+ cursor?: Cursor;
3568
+ /**
3569
+ * The query (including metadata) to filter chats by. If provided, only chats
3570
+ * that match the query will be returned. If not provided, all chats will be returned.
3571
+ * @example
3572
+ * ```
3573
+ * // Filter by presence of metadata values
3574
+ * { metadata: { tag: ["urgent"] } }
3575
+ *
3576
+ * // Filter by absence of metadata key (key must not exist)
3577
+ * { metadata: { archived: null } }
3578
+ * ```
3579
+ */
3580
+ query?: AiChatsQuery;
3581
+ };
3551
3582
  type GetOrCreateChatPair = DefineCmd<"get-or-create-chat", {
3552
3583
  id: ChatId;
3553
3584
  options?: CreateChatOptions;
@@ -3879,7 +3910,7 @@ type AiToolTypePack<A extends JsonObject = JsonObject, R extends JsonObject = Js
3879
3910
  A: A;
3880
3911
  R: R;
3881
3912
  };
3882
- type AskUserMessageInChatOptions = Omit<AiGenerationOptions, "tools" | "knowledge">;
3913
+ type AskUserMessageInChatOptions = Omit<AiGenerationOptions, "tools">;
3883
3914
  type SetToolResultOptions = Omit<AiGenerationOptions, "tools" | "knowledge">;
3884
3915
  type AiToolInvocationProps<A extends JsonObject, R extends JsonObject> = Resolve<DistributiveOmit<AiToolInvocationPart<A, R>, "type"> & {
3885
3916
  respond: (...args: OptionalTupleUnless<R, [result: ToolResultResponse<R>]>) => void;
@@ -3983,8 +4014,8 @@ declare function createStore_forChatMessages(toolsStore: ReturnType<typeof creat
3983
4014
  markMine(messageId: MessageId): void;
3984
4015
  };
3985
4016
  declare function createStore_forUserAiChats(): {
3986
- chatsΣ: DerivedSignal<AiChat[]>;
3987
4017
  getChatById: (chatId: string) => AiChat | undefined;
4018
+ findMany: (query: AiChatsQuery) => AiChat[];
3988
4019
  upsert: (chat: AiChat) => void;
3989
4020
  upsertMany: (chats: AiChat[]) => void;
3990
4021
  markDeleted: (chatId: string) => void;
@@ -3998,9 +4029,7 @@ type Ai = {
3998
4029
  disconnect: () => void;
3999
4030
  getStatus: () => Status;
4000
4031
  /** @private This API will change, and is not considered stable. DO NOT RELY on it. */
4001
- getChats: (options?: {
4002
- cursor?: Cursor;
4003
- }) => Promise<GetChatsResponse>;
4032
+ getChats: (options?: GetChatsOptions) => Promise<GetChatsResponse>;
4004
4033
  /** @private This API will change, and is not considered stable. DO NOT RELY on it. */
4005
4034
  getOrCreateChat: (
4006
4035
  /** A unique identifier for the chat. */
@@ -4025,13 +4054,14 @@ type Ai = {
4025
4054
  setToolResult: (chatId: string, messageId: MessageId, invocationId: string, result: ToolResultResponse, options?: SetToolResultOptions) => Promise<void>;
4026
4055
  /** @private This API will change, and is not considered stable. DO NOT RELY on it. */
4027
4056
  signals: {
4028
- chatsΣ: DerivedSignal<AiChat[]>;
4029
4057
  getChatMessagesForBranchΣ(chatId: string, branch?: MessageId): DerivedSignal<UiChatMessage[]>;
4030
4058
  getToolΣ(name: string, chatId?: string): DerivedSignal<AiOpaqueToolDefinition | undefined>;
4031
4059
  };
4032
4060
  /** @private This API will change, and is not considered stable. DO NOT RELY on it. */
4033
4061
  getChatById: (chatId: string) => AiChat | undefined;
4034
4062
  /** @private This API will change, and is not considered stable. DO NOT RELY on it. */
4063
+ queryChats: (query: AiChatsQuery) => AiChat[];
4064
+ /** @private This API will change, and is not considered stable. DO NOT RELY on it. */
4035
4065
  registerKnowledgeLayer: (uniqueLayerId: string) => LayerKey;
4036
4066
  /** @private This API will change, and is not considered stable. DO NOT RELY on it. */
4037
4067
  deregisterKnowledgeLayer: (layerKey: LayerKey) => void;
@@ -4831,4 +4861,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
4831
4861
  [K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
4832
4862
  };
4833
4863
 
4834
- export { type AckOp, type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUserMessage, 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, type CommentsEventServerMsg, 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 DE, type DM, type DP, type DRI, type DS, 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 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 InferFromSchema, 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, type ManagedPool, type MentionData, type MessageId, MutableSignal, type NoInfr, type NodeMap, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, 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 RejectedStorageOpServerMsg, type Relax, type RenderableToolResultResponse, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomStateServerMsg, type RoomSubscriptionSettings, 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 SubscriptionData, type SubscriptionDataPlain, type SubscriptionDeleteInfo, type SubscriptionDeleteInfoPlain, type SubscriptionKey, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type ToolResultResponse, 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 UserMentionData, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, type WithNavigation, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, checkBounds, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToSubscriptionData, convertToThreadData, convertToUserSubscriptionData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createManagedPool, createNotificationSettings, createThreadId, defineAiTool, deprecate, deprecateIf, detectDupes, entries, errorIf, freeze, generateUrl, getMentionsFromCommentBody, getSubscriptionKey, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isPlainObject, isRootCrdt, isStartsWithOperator, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, patchNotificationSettings, raise, resolveUsersInCommentBody, sanitizeUrl, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };
4864
+ export { type AckOp, type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUserMessage, 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, type CommentsEventServerMsg, 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 DE, type DM, type DP, type DRI, type DS, 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 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 InferFromSchema, 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, type ManagedPool, type MentionData, type MessageId, MutableSignal, type NoInfr, type NodeMap, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, 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 RejectedStorageOpServerMsg, type Relax, type RenderableToolResultResponse, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomStateServerMsg, type RoomSubscriptionSettings, 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 SubscriptionData, type SubscriptionDataPlain, type SubscriptionDeleteInfo, type SubscriptionDeleteInfoPlain, type SubscriptionKey, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type ToolResultResponse, 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 UserMentionData, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, type WithNavigation, type WithOptional, type WithRequired, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, checkBounds, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToSubscriptionData, convertToThreadData, convertToUserSubscriptionData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createManagedPool, createNotificationSettings, createThreadId, defineAiTool, deprecate, deprecateIf, detectDupes, entries, errorIf, freeze, generateUrl, getMentionsFromCommentBody, getSubscriptionKey, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isPlainObject, isRootCrdt, isStartsWithOperator, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, patchNotificationSettings, raise, resolveUsersInCommentBody, sanitizeUrl, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };
package/dist/index.d.ts CHANGED
@@ -3450,6 +3450,12 @@ type Brand<T, TBrand extends string> = T & {
3450
3450
  [brand]: TBrand;
3451
3451
  };
3452
3452
  type DistributiveOmit<T, K extends PropertyKey> = T extends any ? Omit<T, K> : never;
3453
+ type WithRequired<T, K extends keyof T> = T & {
3454
+ [P in K]-?: T[P];
3455
+ };
3456
+ type WithOptional<T, K extends keyof T> = Omit<T, K> & {
3457
+ [P in K]?: T[P];
3458
+ };
3453
3459
  /**
3454
3460
  * Throw an error, but as an expression instead of a statement.
3455
3461
  */
@@ -3538,6 +3544,9 @@ type AbortAiResponse = ServerCmdResponse<AbortAiPair>;
3538
3544
  type GetChatsPair = DefineCmd<"get-chats", {
3539
3545
  cursor?: Cursor;
3540
3546
  pageSize?: number;
3547
+ query?: {
3548
+ metadata?: Record<string, string | string[] | null>;
3549
+ };
3541
3550
  }, {
3542
3551
  chats: AiChat[];
3543
3552
  nextCursor: Cursor | null;
@@ -3548,6 +3557,28 @@ type CreateChatOptions = {
3548
3557
  /** Arbitrary metadata to record for this chat. This can be later used to filter the list of chats by metadata. */
3549
3558
  metadata?: Record<string, string | string[]>;
3550
3559
  };
3560
+ type AiChatsQuery = {
3561
+ metadata?: Record<string, string | string[] | null>;
3562
+ };
3563
+ type GetChatsOptions = {
3564
+ /**
3565
+ * The cursor to use for pagination.
3566
+ */
3567
+ cursor?: Cursor;
3568
+ /**
3569
+ * The query (including metadata) to filter chats by. If provided, only chats
3570
+ * that match the query will be returned. If not provided, all chats will be returned.
3571
+ * @example
3572
+ * ```
3573
+ * // Filter by presence of metadata values
3574
+ * { metadata: { tag: ["urgent"] } }
3575
+ *
3576
+ * // Filter by absence of metadata key (key must not exist)
3577
+ * { metadata: { archived: null } }
3578
+ * ```
3579
+ */
3580
+ query?: AiChatsQuery;
3581
+ };
3551
3582
  type GetOrCreateChatPair = DefineCmd<"get-or-create-chat", {
3552
3583
  id: ChatId;
3553
3584
  options?: CreateChatOptions;
@@ -3879,7 +3910,7 @@ type AiToolTypePack<A extends JsonObject = JsonObject, R extends JsonObject = Js
3879
3910
  A: A;
3880
3911
  R: R;
3881
3912
  };
3882
- type AskUserMessageInChatOptions = Omit<AiGenerationOptions, "tools" | "knowledge">;
3913
+ type AskUserMessageInChatOptions = Omit<AiGenerationOptions, "tools">;
3883
3914
  type SetToolResultOptions = Omit<AiGenerationOptions, "tools" | "knowledge">;
3884
3915
  type AiToolInvocationProps<A extends JsonObject, R extends JsonObject> = Resolve<DistributiveOmit<AiToolInvocationPart<A, R>, "type"> & {
3885
3916
  respond: (...args: OptionalTupleUnless<R, [result: ToolResultResponse<R>]>) => void;
@@ -3983,8 +4014,8 @@ declare function createStore_forChatMessages(toolsStore: ReturnType<typeof creat
3983
4014
  markMine(messageId: MessageId): void;
3984
4015
  };
3985
4016
  declare function createStore_forUserAiChats(): {
3986
- chatsΣ: DerivedSignal<AiChat[]>;
3987
4017
  getChatById: (chatId: string) => AiChat | undefined;
4018
+ findMany: (query: AiChatsQuery) => AiChat[];
3988
4019
  upsert: (chat: AiChat) => void;
3989
4020
  upsertMany: (chats: AiChat[]) => void;
3990
4021
  markDeleted: (chatId: string) => void;
@@ -3998,9 +4029,7 @@ type Ai = {
3998
4029
  disconnect: () => void;
3999
4030
  getStatus: () => Status;
4000
4031
  /** @private This API will change, and is not considered stable. DO NOT RELY on it. */
4001
- getChats: (options?: {
4002
- cursor?: Cursor;
4003
- }) => Promise<GetChatsResponse>;
4032
+ getChats: (options?: GetChatsOptions) => Promise<GetChatsResponse>;
4004
4033
  /** @private This API will change, and is not considered stable. DO NOT RELY on it. */
4005
4034
  getOrCreateChat: (
4006
4035
  /** A unique identifier for the chat. */
@@ -4025,13 +4054,14 @@ type Ai = {
4025
4054
  setToolResult: (chatId: string, messageId: MessageId, invocationId: string, result: ToolResultResponse, options?: SetToolResultOptions) => Promise<void>;
4026
4055
  /** @private This API will change, and is not considered stable. DO NOT RELY on it. */
4027
4056
  signals: {
4028
- chatsΣ: DerivedSignal<AiChat[]>;
4029
4057
  getChatMessagesForBranchΣ(chatId: string, branch?: MessageId): DerivedSignal<UiChatMessage[]>;
4030
4058
  getToolΣ(name: string, chatId?: string): DerivedSignal<AiOpaqueToolDefinition | undefined>;
4031
4059
  };
4032
4060
  /** @private This API will change, and is not considered stable. DO NOT RELY on it. */
4033
4061
  getChatById: (chatId: string) => AiChat | undefined;
4034
4062
  /** @private This API will change, and is not considered stable. DO NOT RELY on it. */
4063
+ queryChats: (query: AiChatsQuery) => AiChat[];
4064
+ /** @private This API will change, and is not considered stable. DO NOT RELY on it. */
4035
4065
  registerKnowledgeLayer: (uniqueLayerId: string) => LayerKey;
4036
4066
  /** @private This API will change, and is not considered stable. DO NOT RELY on it. */
4037
4067
  deregisterKnowledgeLayer: (layerKey: LayerKey) => void;
@@ -4831,4 +4861,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
4831
4861
  [K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
4832
4862
  };
4833
4863
 
4834
- export { type AckOp, type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUserMessage, 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, type CommentsEventServerMsg, 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 DE, type DM, type DP, type DRI, type DS, 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 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 InferFromSchema, 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, type ManagedPool, type MentionData, type MessageId, MutableSignal, type NoInfr, type NodeMap, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, 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 RejectedStorageOpServerMsg, type Relax, type RenderableToolResultResponse, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomStateServerMsg, type RoomSubscriptionSettings, 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 SubscriptionData, type SubscriptionDataPlain, type SubscriptionDeleteInfo, type SubscriptionDeleteInfoPlain, type SubscriptionKey, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type ToolResultResponse, 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 UserMentionData, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, type WithNavigation, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, checkBounds, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToSubscriptionData, convertToThreadData, convertToUserSubscriptionData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createManagedPool, createNotificationSettings, createThreadId, defineAiTool, deprecate, deprecateIf, detectDupes, entries, errorIf, freeze, generateUrl, getMentionsFromCommentBody, getSubscriptionKey, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isPlainObject, isRootCrdt, isStartsWithOperator, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, patchNotificationSettings, raise, resolveUsersInCommentBody, sanitizeUrl, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };
4864
+ export { type AckOp, type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUserMessage, 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, type CommentsEventServerMsg, 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 DE, type DM, type DP, type DRI, type DS, 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 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 InferFromSchema, 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, type ManagedPool, type MentionData, type MessageId, MutableSignal, type NoInfr, type NodeMap, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, 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 RejectedStorageOpServerMsg, type Relax, type RenderableToolResultResponse, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomStateServerMsg, type RoomSubscriptionSettings, 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 SubscriptionData, type SubscriptionDataPlain, type SubscriptionDeleteInfo, type SubscriptionDeleteInfoPlain, type SubscriptionKey, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type ToolResultResponse, 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 UserMentionData, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, type WithNavigation, type WithOptional, type WithRequired, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, checkBounds, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToSubscriptionData, convertToThreadData, convertToUserSubscriptionData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createManagedPool, createNotificationSettings, createThreadId, defineAiTool, deprecate, deprecateIf, detectDupes, entries, errorIf, freeze, generateUrl, getMentionsFromCommentBody, getSubscriptionKey, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isPlainObject, isRootCrdt, isStartsWithOperator, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, patchNotificationSettings, raise, resolveUsersInCommentBody, sanitizeUrl, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };