@liveblocks/core 2.25.0-aiprivatebeta11 → 2.25.0-aiprivatebeta13

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
@@ -3633,7 +3633,7 @@ type ToolResultData = Json;
3633
3633
  type SetToolResultPair = DefineCmd<"set-tool-result", {
3634
3634
  chatId: ChatId;
3635
3635
  messageId: MessageId;
3636
- toolCallId: string;
3636
+ invocationId: string;
3637
3637
  result: ToolResultData;
3638
3638
  generationOptions: AiGenerationOptions;
3639
3639
  }, {
@@ -3642,7 +3642,7 @@ type SetToolResultPair = DefineCmd<"set-tool-result", {
3642
3642
  } | {
3643
3643
  ok: false;
3644
3644
  }>;
3645
- type ServerEvent = RebootedEvent | CmdFailedEvent | ErrorServerEvent | SyncServerEvent | DeltaServerEvent | SettleServerEvent;
3645
+ type ServerEvent = RebootedEvent | CmdFailedEvent | WarningServerEvent | ErrorServerEvent | SyncServerEvent | DeltaServerEvent | SettleServerEvent;
3646
3646
  type RebootedEvent = {
3647
3647
  event: "rebooted";
3648
3648
  };
@@ -3652,6 +3652,10 @@ type CmdFailedEvent = {
3652
3652
  failedCmdId: CmdId;
3653
3653
  error: string;
3654
3654
  };
3655
+ type WarningServerEvent = {
3656
+ event: "warning";
3657
+ message: string;
3658
+ };
3655
3659
  type ErrorServerEvent = {
3656
3660
  event: "error";
3657
3661
  error: string;
@@ -3698,23 +3702,23 @@ type AiToolDescription = {
3698
3702
  type AiToolInvocationPart<A extends JsonObject = JsonObject, R extends ToolResultData = ToolResultData> = Relax<AiReceivingToolInvocationPart | AiExecutingToolInvocationPart<A> | AiExecutedToolInvocationPart<A, R>>;
3699
3703
  type AiReceivingToolInvocationPart = {
3700
3704
  type: "tool-invocation";
3701
- status: "receiving";
3702
- toolCallId: string;
3703
- toolName: string;
3705
+ stage: "receiving";
3706
+ invocationId: string;
3707
+ name: string;
3704
3708
  partialArgs: Json;
3705
3709
  };
3706
3710
  type AiExecutingToolInvocationPart<A extends JsonObject = JsonObject> = {
3707
3711
  type: "tool-invocation";
3708
- status: "executing";
3709
- toolCallId: string;
3710
- toolName: string;
3712
+ stage: "executing";
3713
+ invocationId: string;
3714
+ name: string;
3711
3715
  args: A;
3712
3716
  };
3713
3717
  type AiExecutedToolInvocationPart<A extends JsonObject = JsonObject, R extends ToolResultData = ToolResultData> = {
3714
3718
  type: "tool-invocation";
3715
- status: "executed";
3716
- toolCallId: string;
3717
- toolName: string;
3719
+ stage: "executed";
3720
+ invocationId: string;
3721
+ name: string;
3718
3722
  args: A;
3719
3723
  result: R;
3720
3724
  };
@@ -3804,34 +3808,66 @@ type AiKnowledgeSource = {
3804
3808
  value: Json;
3805
3809
  };
3806
3810
 
3807
- type InferFromSchema<T extends JSONSchema7> = JSONSchema7 extends T ? JsonObject : T extends {
3808
- type: "object";
3809
- properties: Record<string, JSONSchema7>;
3810
- required: readonly string[];
3811
- } ? Resolve<{
3812
- -readonly [K in keyof T["properties"] as K extends string ? K extends Extract<K, T["required"][number]> ? K : never : never]: InferFromSchema<T["properties"][K]>;
3813
- } & {
3814
- -readonly [K in keyof T["properties"] as K extends string ? K extends Extract<K, T["required"][number]> ? never : K : never]?: InferFromSchema<T["properties"][K]>;
3815
- }> : T extends {
3811
+ type JSONObjectSchema7 = JSONSchema7 & {
3816
3812
  type: "object";
3817
- properties: Record<string, JSONSchema7>;
3813
+ };
3814
+ type NoFields = {};
3815
+ type Infer<T> = T extends JSONSchema7 ? InferFromSchema<T> : never;
3816
+ type InferAllOf<T extends readonly JSONSchema7[]> = T extends readonly [
3817
+ infer U,
3818
+ ...infer R
3819
+ ] ? R extends readonly JSONSchema7[] ? Infer<U> & InferAllOf<R> : Infer<U> : unknown;
3820
+ type InferRequireds<P, R extends readonly string[]> = {
3821
+ -readonly [K in keyof P as K extends string ? K extends Extract<K, R[number]> ? K : never : never]: Infer<P[K]>;
3822
+ };
3823
+ type InferOptionals<P, R extends readonly string[]> = {
3824
+ -readonly [K in keyof P as K extends string ? K extends Extract<K, R[number]> ? never : K : never]?: Infer<P[K]>;
3825
+ };
3826
+ type InferBaseObject<T extends JSONObjectSchema7> = T extends {
3827
+ properties?: infer P extends Record<string, JSONSchema7>;
3828
+ required?: infer R;
3829
+ } ? InferRequireds<P, R extends readonly string[] ? R : []> & InferOptionals<P, R extends readonly string[] ? R : []> : NoFields;
3830
+ type InferAdditionals<T extends JSONObjectSchema7> = T extends {
3831
+ additionalProperties: false;
3832
+ } ? NoFields : T extends {
3833
+ additionalProperties?: true;
3834
+ } ? JsonObject : T extends {
3835
+ additionalProperties: infer A;
3818
3836
  } ? {
3819
- -readonly [K in keyof T["properties"]]?: InferFromSchema<T["properties"][K]>;
3820
- } : T extends {
3821
- type: "string" | "number" | "boolean";
3837
+ [extra: string]: Infer<A> | undefined;
3838
+ } : JsonObject;
3839
+ type InferFromObjectSchema<T extends JSONObjectSchema7> = Resolve<InferBaseObject<T> & InferAdditionals<T>>;
3840
+ type InferFromArraySchema<T extends JSONSchema7> = T extends {
3841
+ items: infer U;
3842
+ } ? Infer<U>[] : Json[];
3843
+ type InferFromSchema<T extends JSONSchema7> = JSONSchema7 extends T ? JsonObject : T extends {
3844
+ type: "object";
3845
+ } ? InferFromObjectSchema<T> : T extends {
3846
+ type: "array";
3847
+ } ? InferFromArraySchema<T> : T extends {
3848
+ oneOf: readonly (infer U)[];
3849
+ } ? Infer<U> : T extends {
3850
+ anyOf: readonly (infer U)[];
3851
+ } ? Infer<U> : T extends {
3852
+ allOf: readonly JSONSchema7[];
3853
+ } ? InferAllOf<T["allOf"]> : T extends {
3854
+ not: JSONSchema7;
3855
+ } ? Json : T extends {
3822
3856
  enum: readonly (infer U)[];
3823
3857
  } ? U : T extends {
3858
+ const: infer C;
3859
+ } ? C : T extends {
3824
3860
  type: "string";
3825
3861
  } ? string : T extends {
3826
3862
  type: "number";
3863
+ } ? number : T extends {
3864
+ type: "integer";
3827
3865
  } ? number : T extends {
3828
3866
  type: "boolean";
3829
3867
  } ? boolean : T extends {
3830
3868
  type: "null";
3831
- } ? null : T extends {
3832
- type: "array";
3833
- items: JSONSchema7;
3834
- } ? InferFromSchema<T["items"]>[] : unknown;
3869
+ } ? null : Json;
3870
+
3835
3871
  type AiToolTypePack<A extends JsonObject = JsonObject, R extends ToolResultData = ToolResultData> = {
3836
3872
  A: A;
3837
3873
  R: R;
@@ -3861,8 +3897,8 @@ type AiToolInvocationProps<A extends JsonObject, R extends ToolResultData> = Res
3861
3897
  }>;
3862
3898
  type AiOpaqueToolInvocationProps = AiToolInvocationProps<JsonObject, ToolResultData>;
3863
3899
  type AiToolExecuteContext = {
3864
- toolName: string;
3865
- toolCallId: string;
3900
+ name: string;
3901
+ invocationId: string;
3866
3902
  };
3867
3903
  type AiToolExecuteCallback<A extends JsonObject, R extends ToolResultData> = (args: A, context: AiToolExecuteContext) => Awaitable<R>;
3868
3904
  type AiToolDefinition<S extends JSONObjectSchema7, A extends JsonObject, R extends ToolResultData> = {
@@ -3872,63 +3908,30 @@ type AiToolDefinition<S extends JSONObjectSchema7, A extends JsonObject, R exten
3872
3908
  render?: (props: AiToolInvocationProps<A, R>) => unknown;
3873
3909
  };
3874
3910
  type AiOpaqueToolDefinition = AiToolDefinition<JSONObjectSchema7, JsonObject, ToolResultData>;
3875
- type JSONObjectSchema7 = JSONSchema7 & {
3876
- type: "object";
3877
- };
3878
3911
  /**
3879
3912
  * Helper function to help infer the types of `args`, `render`, and `result`.
3880
3913
  * This function has no runtime implementation and is only needed to make it
3881
3914
  * possible for TypeScript to infer types.
3882
3915
  */
3883
3916
  declare function defineAiTool<R extends ToolResultData>(): <const S extends JSONObjectSchema7>(def: AiToolDefinition<S, InferFromSchema<S> extends JsonObject ? InferFromSchema<S> : JsonObject, R>) => AiOpaqueToolDefinition;
3884
- type UiChatMessage = AiChatMessage & {
3885
- navigation: {
3886
- /**
3887
- * The message ID of the parent message, or null if there is no parent.
3888
- */
3889
- parent: MessageId | null;
3890
- /**
3891
- * The message ID of the left sibling message, or null if there is no left sibling.
3892
- */
3893
- prev: MessageId | null;
3894
- /**
3895
- * The message ID of the right sibling message, or null if there is no right sibling.
3896
- */
3897
- next: MessageId | null;
3898
- };
3899
- };
3900
- type UiUserMessage = AiUserMessage & {
3901
- navigation: {
3902
- /**
3903
- * The message ID of the parent message, or null if there is no parent.
3904
- */
3905
- parent: MessageId | null;
3906
- /**
3907
- * The message ID of the left sibling message, or null if there is no left sibling.
3908
- */
3909
- prev: MessageId | null;
3910
- /**
3911
- * The message ID of the right sibling message, or null if there is no right sibling.
3912
- */
3913
- next: MessageId | null;
3914
- };
3917
+ type NavigationInfo = {
3918
+ /**
3919
+ * The message ID of the parent message, or null if there is no parent.
3920
+ */
3921
+ parent: MessageId | null;
3922
+ /**
3923
+ * The message ID of the left sibling message, or null if there is no left sibling.
3924
+ */
3925
+ prev: MessageId | null;
3926
+ /**
3927
+ * The message ID of the right sibling message, or null if there is no right sibling.
3928
+ */
3929
+ next: MessageId | null;
3915
3930
  };
3916
- type UiAssistantMessage = AiAssistantMessage & {
3917
- navigation: {
3918
- /**
3919
- * The message ID of the parent message, or null if there is no parent.
3920
- */
3921
- parent: MessageId | null;
3922
- /**
3923
- * The message ID of the left sibling message, or null if there is no left sibling.
3924
- */
3925
- prev: MessageId | null;
3926
- /**
3927
- * The message ID of the right sibling message, or null if there is no right sibling.
3928
- */
3929
- next: MessageId | null;
3930
- };
3931
+ type WithNavigation<T> = T & {
3932
+ navigation: NavigationInfo;
3931
3933
  };
3934
+ type UiChatMessage = WithNavigation<AiChatMessage>;
3932
3935
  type AiContext = {
3933
3936
  staticSessionInfoSig: Signal<StaticSessionInfo | null>;
3934
3937
  dynamicSessionInfoSig: Signal<DynamicSessionInfo | null>;
@@ -3956,7 +3959,7 @@ declare function createStore_forTools(): {
3956
3959
  getToolΣ: (name: string, chatId?: string) => DerivedSignal<AiOpaqueToolDefinition | undefined>;
3957
3960
  registerTool: (name: string, tool: AiOpaqueToolDefinition, chatId?: string) => () => void;
3958
3961
  };
3959
- declare function createStore_forChatMessages(toolsStore: ReturnType<typeof createStore_forTools>, setToolResult: (chatId: string, messageId: MessageId, toolCallId: string, result: ToolResultData, options?: SetToolResultOptions) => Promise<SetToolResultResponse>): {
3962
+ declare function createStore_forChatMessages(toolsStore: ReturnType<typeof createStore_forTools>, setToolResult: (chatId: string, messageId: MessageId, invocationId: string, result: ToolResultData, options?: SetToolResultOptions) => Promise<SetToolResultResponse>): {
3960
3963
  getMessageById: (messageId: MessageId) => AiChatMessage | undefined;
3961
3964
  getChatMessagesForBranchΣ: (chatId: string, branch?: MessageId) => DerivedSignal<UiChatMessage[]>;
3962
3965
  createOptimistically: {
@@ -4012,7 +4015,7 @@ type Ai = {
4012
4015
  /** @private This API will change, and is not considered stable. DO NOT RELY on it. */
4013
4016
  abort: (messageId: MessageId) => Promise<AbortAiResponse>;
4014
4017
  /** @private This API will change, and is not considered stable. DO NOT RELY on it. */
4015
- setToolResult: (chatId: string, messageId: MessageId, toolCallId: string, result: ToolResultData, options?: SetToolResultOptions) => Promise<SetToolResultResponse>;
4018
+ setToolResult: (chatId: string, messageId: MessageId, invocationId: string, result: ToolResultData, options?: SetToolResultOptions) => Promise<SetToolResultResponse>;
4016
4019
  /** @private This API will change, and is not considered stable. DO NOT RELY on it. */
4017
4020
  signals: {
4018
4021
  chatsΣ: DerivedSignal<AiChat[]>;
@@ -4819,4 +4822,4 @@ declare const CommentsApiError: typeof HttpError;
4819
4822
  /** @deprecated Use HttpError instead. */
4820
4823
  declare const NotificationsApiError: typeof HttpError;
4821
4824
 
4822
- export { type AckOp, type ActivityData, type AiAssistantContentPart, 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 AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, CommentsApiError, type CommentsEventServerMsg, type ContextualPromptContext, type ContextualPromptResponse, 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 MessageId, MutableSignal, type NoInfr, type NodeMap, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, NotificationsApiError, 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 Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, 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 ToolResultData, type URLSafeString, type UiAssistantMessage, type UiChatMessage, type UiUserMessage, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type User, type UserJoinServerMsg, type UserLeftServerMsg, type UserNotificationSettings, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, 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, generateCommentUrl, getMentionedIdsFromCommentBody, 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, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toAbsoluteUrl, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };
4825
+ 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, CommentsApiError, 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 MessageId, MutableSignal, type NoInfr, type NodeMap, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, NotificationsApiError, 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 Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, 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 ToolResultData, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type User, type UserJoinServerMsg, type UserLeftServerMsg, type UserNotificationSettings, 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, generateCommentUrl, getMentionedIdsFromCommentBody, 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, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toAbsoluteUrl, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };
package/dist/index.d.ts CHANGED
@@ -3633,7 +3633,7 @@ type ToolResultData = Json;
3633
3633
  type SetToolResultPair = DefineCmd<"set-tool-result", {
3634
3634
  chatId: ChatId;
3635
3635
  messageId: MessageId;
3636
- toolCallId: string;
3636
+ invocationId: string;
3637
3637
  result: ToolResultData;
3638
3638
  generationOptions: AiGenerationOptions;
3639
3639
  }, {
@@ -3642,7 +3642,7 @@ type SetToolResultPair = DefineCmd<"set-tool-result", {
3642
3642
  } | {
3643
3643
  ok: false;
3644
3644
  }>;
3645
- type ServerEvent = RebootedEvent | CmdFailedEvent | ErrorServerEvent | SyncServerEvent | DeltaServerEvent | SettleServerEvent;
3645
+ type ServerEvent = RebootedEvent | CmdFailedEvent | WarningServerEvent | ErrorServerEvent | SyncServerEvent | DeltaServerEvent | SettleServerEvent;
3646
3646
  type RebootedEvent = {
3647
3647
  event: "rebooted";
3648
3648
  };
@@ -3652,6 +3652,10 @@ type CmdFailedEvent = {
3652
3652
  failedCmdId: CmdId;
3653
3653
  error: string;
3654
3654
  };
3655
+ type WarningServerEvent = {
3656
+ event: "warning";
3657
+ message: string;
3658
+ };
3655
3659
  type ErrorServerEvent = {
3656
3660
  event: "error";
3657
3661
  error: string;
@@ -3698,23 +3702,23 @@ type AiToolDescription = {
3698
3702
  type AiToolInvocationPart<A extends JsonObject = JsonObject, R extends ToolResultData = ToolResultData> = Relax<AiReceivingToolInvocationPart | AiExecutingToolInvocationPart<A> | AiExecutedToolInvocationPart<A, R>>;
3699
3703
  type AiReceivingToolInvocationPart = {
3700
3704
  type: "tool-invocation";
3701
- status: "receiving";
3702
- toolCallId: string;
3703
- toolName: string;
3705
+ stage: "receiving";
3706
+ invocationId: string;
3707
+ name: string;
3704
3708
  partialArgs: Json;
3705
3709
  };
3706
3710
  type AiExecutingToolInvocationPart<A extends JsonObject = JsonObject> = {
3707
3711
  type: "tool-invocation";
3708
- status: "executing";
3709
- toolCallId: string;
3710
- toolName: string;
3712
+ stage: "executing";
3713
+ invocationId: string;
3714
+ name: string;
3711
3715
  args: A;
3712
3716
  };
3713
3717
  type AiExecutedToolInvocationPart<A extends JsonObject = JsonObject, R extends ToolResultData = ToolResultData> = {
3714
3718
  type: "tool-invocation";
3715
- status: "executed";
3716
- toolCallId: string;
3717
- toolName: string;
3719
+ stage: "executed";
3720
+ invocationId: string;
3721
+ name: string;
3718
3722
  args: A;
3719
3723
  result: R;
3720
3724
  };
@@ -3804,34 +3808,66 @@ type AiKnowledgeSource = {
3804
3808
  value: Json;
3805
3809
  };
3806
3810
 
3807
- type InferFromSchema<T extends JSONSchema7> = JSONSchema7 extends T ? JsonObject : T extends {
3808
- type: "object";
3809
- properties: Record<string, JSONSchema7>;
3810
- required: readonly string[];
3811
- } ? Resolve<{
3812
- -readonly [K in keyof T["properties"] as K extends string ? K extends Extract<K, T["required"][number]> ? K : never : never]: InferFromSchema<T["properties"][K]>;
3813
- } & {
3814
- -readonly [K in keyof T["properties"] as K extends string ? K extends Extract<K, T["required"][number]> ? never : K : never]?: InferFromSchema<T["properties"][K]>;
3815
- }> : T extends {
3811
+ type JSONObjectSchema7 = JSONSchema7 & {
3816
3812
  type: "object";
3817
- properties: Record<string, JSONSchema7>;
3813
+ };
3814
+ type NoFields = {};
3815
+ type Infer<T> = T extends JSONSchema7 ? InferFromSchema<T> : never;
3816
+ type InferAllOf<T extends readonly JSONSchema7[]> = T extends readonly [
3817
+ infer U,
3818
+ ...infer R
3819
+ ] ? R extends readonly JSONSchema7[] ? Infer<U> & InferAllOf<R> : Infer<U> : unknown;
3820
+ type InferRequireds<P, R extends readonly string[]> = {
3821
+ -readonly [K in keyof P as K extends string ? K extends Extract<K, R[number]> ? K : never : never]: Infer<P[K]>;
3822
+ };
3823
+ type InferOptionals<P, R extends readonly string[]> = {
3824
+ -readonly [K in keyof P as K extends string ? K extends Extract<K, R[number]> ? never : K : never]?: Infer<P[K]>;
3825
+ };
3826
+ type InferBaseObject<T extends JSONObjectSchema7> = T extends {
3827
+ properties?: infer P extends Record<string, JSONSchema7>;
3828
+ required?: infer R;
3829
+ } ? InferRequireds<P, R extends readonly string[] ? R : []> & InferOptionals<P, R extends readonly string[] ? R : []> : NoFields;
3830
+ type InferAdditionals<T extends JSONObjectSchema7> = T extends {
3831
+ additionalProperties: false;
3832
+ } ? NoFields : T extends {
3833
+ additionalProperties?: true;
3834
+ } ? JsonObject : T extends {
3835
+ additionalProperties: infer A;
3818
3836
  } ? {
3819
- -readonly [K in keyof T["properties"]]?: InferFromSchema<T["properties"][K]>;
3820
- } : T extends {
3821
- type: "string" | "number" | "boolean";
3837
+ [extra: string]: Infer<A> | undefined;
3838
+ } : JsonObject;
3839
+ type InferFromObjectSchema<T extends JSONObjectSchema7> = Resolve<InferBaseObject<T> & InferAdditionals<T>>;
3840
+ type InferFromArraySchema<T extends JSONSchema7> = T extends {
3841
+ items: infer U;
3842
+ } ? Infer<U>[] : Json[];
3843
+ type InferFromSchema<T extends JSONSchema7> = JSONSchema7 extends T ? JsonObject : T extends {
3844
+ type: "object";
3845
+ } ? InferFromObjectSchema<T> : T extends {
3846
+ type: "array";
3847
+ } ? InferFromArraySchema<T> : T extends {
3848
+ oneOf: readonly (infer U)[];
3849
+ } ? Infer<U> : T extends {
3850
+ anyOf: readonly (infer U)[];
3851
+ } ? Infer<U> : T extends {
3852
+ allOf: readonly JSONSchema7[];
3853
+ } ? InferAllOf<T["allOf"]> : T extends {
3854
+ not: JSONSchema7;
3855
+ } ? Json : T extends {
3822
3856
  enum: readonly (infer U)[];
3823
3857
  } ? U : T extends {
3858
+ const: infer C;
3859
+ } ? C : T extends {
3824
3860
  type: "string";
3825
3861
  } ? string : T extends {
3826
3862
  type: "number";
3863
+ } ? number : T extends {
3864
+ type: "integer";
3827
3865
  } ? number : T extends {
3828
3866
  type: "boolean";
3829
3867
  } ? boolean : T extends {
3830
3868
  type: "null";
3831
- } ? null : T extends {
3832
- type: "array";
3833
- items: JSONSchema7;
3834
- } ? InferFromSchema<T["items"]>[] : unknown;
3869
+ } ? null : Json;
3870
+
3835
3871
  type AiToolTypePack<A extends JsonObject = JsonObject, R extends ToolResultData = ToolResultData> = {
3836
3872
  A: A;
3837
3873
  R: R;
@@ -3861,8 +3897,8 @@ type AiToolInvocationProps<A extends JsonObject, R extends ToolResultData> = Res
3861
3897
  }>;
3862
3898
  type AiOpaqueToolInvocationProps = AiToolInvocationProps<JsonObject, ToolResultData>;
3863
3899
  type AiToolExecuteContext = {
3864
- toolName: string;
3865
- toolCallId: string;
3900
+ name: string;
3901
+ invocationId: string;
3866
3902
  };
3867
3903
  type AiToolExecuteCallback<A extends JsonObject, R extends ToolResultData> = (args: A, context: AiToolExecuteContext) => Awaitable<R>;
3868
3904
  type AiToolDefinition<S extends JSONObjectSchema7, A extends JsonObject, R extends ToolResultData> = {
@@ -3872,63 +3908,30 @@ type AiToolDefinition<S extends JSONObjectSchema7, A extends JsonObject, R exten
3872
3908
  render?: (props: AiToolInvocationProps<A, R>) => unknown;
3873
3909
  };
3874
3910
  type AiOpaqueToolDefinition = AiToolDefinition<JSONObjectSchema7, JsonObject, ToolResultData>;
3875
- type JSONObjectSchema7 = JSONSchema7 & {
3876
- type: "object";
3877
- };
3878
3911
  /**
3879
3912
  * Helper function to help infer the types of `args`, `render`, and `result`.
3880
3913
  * This function has no runtime implementation and is only needed to make it
3881
3914
  * possible for TypeScript to infer types.
3882
3915
  */
3883
3916
  declare function defineAiTool<R extends ToolResultData>(): <const S extends JSONObjectSchema7>(def: AiToolDefinition<S, InferFromSchema<S> extends JsonObject ? InferFromSchema<S> : JsonObject, R>) => AiOpaqueToolDefinition;
3884
- type UiChatMessage = AiChatMessage & {
3885
- navigation: {
3886
- /**
3887
- * The message ID of the parent message, or null if there is no parent.
3888
- */
3889
- parent: MessageId | null;
3890
- /**
3891
- * The message ID of the left sibling message, or null if there is no left sibling.
3892
- */
3893
- prev: MessageId | null;
3894
- /**
3895
- * The message ID of the right sibling message, or null if there is no right sibling.
3896
- */
3897
- next: MessageId | null;
3898
- };
3899
- };
3900
- type UiUserMessage = AiUserMessage & {
3901
- navigation: {
3902
- /**
3903
- * The message ID of the parent message, or null if there is no parent.
3904
- */
3905
- parent: MessageId | null;
3906
- /**
3907
- * The message ID of the left sibling message, or null if there is no left sibling.
3908
- */
3909
- prev: MessageId | null;
3910
- /**
3911
- * The message ID of the right sibling message, or null if there is no right sibling.
3912
- */
3913
- next: MessageId | null;
3914
- };
3917
+ type NavigationInfo = {
3918
+ /**
3919
+ * The message ID of the parent message, or null if there is no parent.
3920
+ */
3921
+ parent: MessageId | null;
3922
+ /**
3923
+ * The message ID of the left sibling message, or null if there is no left sibling.
3924
+ */
3925
+ prev: MessageId | null;
3926
+ /**
3927
+ * The message ID of the right sibling message, or null if there is no right sibling.
3928
+ */
3929
+ next: MessageId | null;
3915
3930
  };
3916
- type UiAssistantMessage = AiAssistantMessage & {
3917
- navigation: {
3918
- /**
3919
- * The message ID of the parent message, or null if there is no parent.
3920
- */
3921
- parent: MessageId | null;
3922
- /**
3923
- * The message ID of the left sibling message, or null if there is no left sibling.
3924
- */
3925
- prev: MessageId | null;
3926
- /**
3927
- * The message ID of the right sibling message, or null if there is no right sibling.
3928
- */
3929
- next: MessageId | null;
3930
- };
3931
+ type WithNavigation<T> = T & {
3932
+ navigation: NavigationInfo;
3931
3933
  };
3934
+ type UiChatMessage = WithNavigation<AiChatMessage>;
3932
3935
  type AiContext = {
3933
3936
  staticSessionInfoSig: Signal<StaticSessionInfo | null>;
3934
3937
  dynamicSessionInfoSig: Signal<DynamicSessionInfo | null>;
@@ -3956,7 +3959,7 @@ declare function createStore_forTools(): {
3956
3959
  getToolΣ: (name: string, chatId?: string) => DerivedSignal<AiOpaqueToolDefinition | undefined>;
3957
3960
  registerTool: (name: string, tool: AiOpaqueToolDefinition, chatId?: string) => () => void;
3958
3961
  };
3959
- declare function createStore_forChatMessages(toolsStore: ReturnType<typeof createStore_forTools>, setToolResult: (chatId: string, messageId: MessageId, toolCallId: string, result: ToolResultData, options?: SetToolResultOptions) => Promise<SetToolResultResponse>): {
3962
+ declare function createStore_forChatMessages(toolsStore: ReturnType<typeof createStore_forTools>, setToolResult: (chatId: string, messageId: MessageId, invocationId: string, result: ToolResultData, options?: SetToolResultOptions) => Promise<SetToolResultResponse>): {
3960
3963
  getMessageById: (messageId: MessageId) => AiChatMessage | undefined;
3961
3964
  getChatMessagesForBranchΣ: (chatId: string, branch?: MessageId) => DerivedSignal<UiChatMessage[]>;
3962
3965
  createOptimistically: {
@@ -4012,7 +4015,7 @@ type Ai = {
4012
4015
  /** @private This API will change, and is not considered stable. DO NOT RELY on it. */
4013
4016
  abort: (messageId: MessageId) => Promise<AbortAiResponse>;
4014
4017
  /** @private This API will change, and is not considered stable. DO NOT RELY on it. */
4015
- setToolResult: (chatId: string, messageId: MessageId, toolCallId: string, result: ToolResultData, options?: SetToolResultOptions) => Promise<SetToolResultResponse>;
4018
+ setToolResult: (chatId: string, messageId: MessageId, invocationId: string, result: ToolResultData, options?: SetToolResultOptions) => Promise<SetToolResultResponse>;
4016
4019
  /** @private This API will change, and is not considered stable. DO NOT RELY on it. */
4017
4020
  signals: {
4018
4021
  chatsΣ: DerivedSignal<AiChat[]>;
@@ -4819,4 +4822,4 @@ declare const CommentsApiError: typeof HttpError;
4819
4822
  /** @deprecated Use HttpError instead. */
4820
4823
  declare const NotificationsApiError: typeof HttpError;
4821
4824
 
4822
- export { type AckOp, type ActivityData, type AiAssistantContentPart, 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 AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, CommentsApiError, type CommentsEventServerMsg, type ContextualPromptContext, type ContextualPromptResponse, 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 MessageId, MutableSignal, type NoInfr, type NodeMap, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, NotificationsApiError, 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 Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, 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 ToolResultData, type URLSafeString, type UiAssistantMessage, type UiChatMessage, type UiUserMessage, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type User, type UserJoinServerMsg, type UserLeftServerMsg, type UserNotificationSettings, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, 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, generateCommentUrl, getMentionedIdsFromCommentBody, 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, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toAbsoluteUrl, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };
4825
+ 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, CommentsApiError, 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 MessageId, MutableSignal, type NoInfr, type NodeMap, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, NotificationsApiError, 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 Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, 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 ToolResultData, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type User, type UserJoinServerMsg, type UserLeftServerMsg, type UserNotificationSettings, 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, generateCommentUrl, getMentionedIdsFromCommentBody, 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, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toAbsoluteUrl, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ var __export = (target, all) => {
6
6
 
7
7
  // src/version.ts
8
8
  var PKG_NAME = "@liveblocks/core";
9
- var PKG_VERSION = "2.25.0-aiprivatebeta11";
9
+ var PKG_VERSION = "2.25.0-aiprivatebeta13";
10
10
  var PKG_FORMAT = "esm";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -3918,18 +3918,18 @@ function createStore_forChatMessages(toolsStore, setToolResult) {
3918
3918
  }
3919
3919
  if (message.role === "assistant" && message.status === "awaiting-tool") {
3920
3920
  for (const toolCall of message.contentSoFar.filter(
3921
- (part) => part.type === "tool-invocation" && part.status === "executing"
3921
+ (part) => part.type === "tool-invocation" && part.stage === "executing"
3922
3922
  )) {
3923
- if (seenToolCallIds.has(toolCall.toolCallId)) {
3923
+ if (seenToolCallIds.has(toolCall.invocationId)) {
3924
3924
  continue;
3925
3925
  }
3926
- seenToolCallIds.add(toolCall.toolCallId);
3927
- const toolDef = toolsStore.getTool\u03A3(toolCall.toolName, message.chatId).get();
3926
+ seenToolCallIds.add(toolCall.invocationId);
3927
+ const toolDef = toolsStore.getTool\u03A3(toolCall.name, message.chatId).get();
3928
3928
  const respondSync = (result) => {
3929
3929
  setToolResult(
3930
3930
  message.chatId,
3931
3931
  message.id,
3932
- toolCall.toolCallId,
3932
+ toolCall.invocationId,
3933
3933
  result
3934
3934
  // TODO Pass in AiGenerationOptions here, or make the backend use the same options
3935
3935
  ).catch((err) => {
@@ -3942,8 +3942,8 @@ function createStore_forChatMessages(toolsStore, setToolResult) {
3942
3942
  if (executeFn && autoExecutableMessages.has(message.id)) {
3943
3943
  (async () => {
3944
3944
  const result = await executeFn(toolCall.args, {
3945
- toolName: toolCall.toolName,
3946
- toolCallId: toolCall.toolCallId
3945
+ name: toolCall.name,
3946
+ invocationId: toolCall.invocationId
3947
3947
  });
3948
3948
  respondSync(result);
3949
3949
  })().catch((err) => {
@@ -4231,7 +4231,11 @@ function createAi(config) {
4231
4231
  context.messagesStore.upsert(msg.message);
4232
4232
  break;
4233
4233
  }
4234
+ case "warning":
4235
+ warn(msg.message);
4236
+ break;
4234
4237
  case "error":
4238
+ error2(msg.error);
4235
4239
  break;
4236
4240
  case "rebooted":
4237
4241
  context.messagesStore.failAllPending();
@@ -4366,14 +4370,14 @@ function createAi(config) {
4366
4370
  function updateKnowledge(layerKey, data, key = nanoid()) {
4367
4371
  context.knowledge.updateKnowledge(layerKey, key, data);
4368
4372
  }
4369
- async function setToolResult(chatId, messageId, toolCallId, result, options) {
4373
+ async function setToolResult(chatId, messageId, invocationId, result, options) {
4370
4374
  const knowledge = context.knowledge.get();
4371
4375
  const tools = context.toolsStore.getToolDescriptions(chatId);
4372
4376
  const resp = await sendClientMsgWithResponse({
4373
4377
  cmd: "set-tool-result",
4374
4378
  chatId,
4375
4379
  messageId,
4376
- toolCallId,
4380
+ invocationId,
4377
4381
  result,
4378
4382
  generationOptions: {
4379
4383
  copilotId: options?.copilotId,
@@ -4455,7 +4459,7 @@ function makeCreateSocketDelegateForAi(baseUrl, WebSocketPolyfill) {
4455
4459
  }
4456
4460
  const url2 = new URL(baseUrl);
4457
4461
  url2.protocol = url2.protocol === "http:" ? "ws" : "wss";
4458
- url2.pathname = "/ai/v1";
4462
+ url2.pathname = "/ai/v3";
4459
4463
  if (authValue.type === "secret") {
4460
4464
  url2.searchParams.set("tok", authValue.token.raw);
4461
4465
  } else if (authValue.type === "public") {