@liveblocks/core 3.5.3 → 3.5.4
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.cjs +114 -170
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -29
- package/dist/index.d.ts +4 -29
- package/dist/index.js +15 -71
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -3449,7 +3449,6 @@ declare const brand: unique symbol;
|
|
|
3449
3449
|
type Brand<T, TBrand extends string> = T & {
|
|
3450
3450
|
[brand]: TBrand;
|
|
3451
3451
|
};
|
|
3452
|
-
type ISODateString = Brand<string, "ISODateString">;
|
|
3453
3452
|
type DistributiveOmit<T, K extends PropertyKey> = T extends any ? Omit<T, K> : never;
|
|
3454
3453
|
type WithRequired<T, K extends keyof T> = T & {
|
|
3455
3454
|
[P in K]-?: T[P];
|
|
@@ -3520,6 +3519,7 @@ declare function memoizeOnSuccess<T>(factoryFn: () => Promise<T>): () => Promise
|
|
|
3520
3519
|
declare function findLastIndex<T>(arr: T[], predicate: (value: T, index: number, obj: T[]) => boolean): number;
|
|
3521
3520
|
|
|
3522
3521
|
type Cursor = Brand<string, "Cursor">;
|
|
3522
|
+
type ISODateString = Brand<string, "ISODateString">;
|
|
3523
3523
|
type ChatId = string;
|
|
3524
3524
|
type MessageId = Brand<`ms_${string}`, "MessageId">;
|
|
3525
3525
|
type CmdId = Brand<string, "CmdId">;
|
|
@@ -3796,8 +3796,6 @@ type AiToolInvocationDelta = {
|
|
|
3796
3796
|
type AiReasoningPart = {
|
|
3797
3797
|
type: "reasoning";
|
|
3798
3798
|
text: string;
|
|
3799
|
-
startedAt: ISODateString;
|
|
3800
|
-
endedAt?: ISODateString;
|
|
3801
3799
|
};
|
|
3802
3800
|
type AiUploadedImagePart = {
|
|
3803
3801
|
type: "image";
|
|
@@ -3806,21 +3804,9 @@ type AiUploadedImagePart = {
|
|
|
3806
3804
|
size: number;
|
|
3807
3805
|
mimeType: string;
|
|
3808
3806
|
};
|
|
3809
|
-
/**
|
|
3810
|
-
* Represents a pending or completed knowledge retrieval operation.
|
|
3811
|
-
* Since protocol V6.
|
|
3812
|
-
*/
|
|
3813
|
-
type AiRetrievalPart = {
|
|
3814
|
-
type: "retrieval";
|
|
3815
|
-
kind: "knowledge";
|
|
3816
|
-
id: string;
|
|
3817
|
-
query: string;
|
|
3818
|
-
startedAt: ISODateString;
|
|
3819
|
-
endedAt?: ISODateString;
|
|
3820
|
-
};
|
|
3821
3807
|
type AiUserContentPart = AiTextPart | AiUploadedImagePart;
|
|
3822
|
-
type AiAssistantContentPart = AiReasoningPart | AiTextPart | AiToolInvocationPart
|
|
3823
|
-
type AiAssistantDeltaUpdate = AiTextDelta | AiReasoningDelta | AiExecutingToolInvocationPart | AiToolInvocationStreamStart | AiToolInvocationDelta
|
|
3808
|
+
type AiAssistantContentPart = AiReasoningPart | AiTextPart | AiToolInvocationPart;
|
|
3809
|
+
type AiAssistantDeltaUpdate = AiTextDelta | AiReasoningDelta | AiExecutingToolInvocationPart | AiToolInvocationStreamStart | AiToolInvocationDelta;
|
|
3824
3810
|
type AiUserMessage = {
|
|
3825
3811
|
id: MessageId;
|
|
3826
3812
|
chatId: ChatId;
|
|
@@ -4050,17 +4036,6 @@ declare function createStore_forChatMessages(toolsStore: ReturnType<typeof creat
|
|
|
4050
4036
|
addDelta: (messageId: MessageId, delta: AiAssistantDeltaUpdate) => void;
|
|
4051
4037
|
failAllPending: () => void;
|
|
4052
4038
|
markMine(messageId: MessageId): void;
|
|
4053
|
-
/**
|
|
4054
|
-
* Iterates over all my auto-executing messages.
|
|
4055
|
-
*
|
|
4056
|
-
* These are messages that match all these conditions:
|
|
4057
|
-
* - The message is an assistant message
|
|
4058
|
-
* - The message is owned by this client ("mine")
|
|
4059
|
-
* - The message is currently in "awaiting-tool" status
|
|
4060
|
-
* - The message has at least one tool invocation in "executing" stage
|
|
4061
|
-
* - The tool invocation has an execute() function defined
|
|
4062
|
-
*/
|
|
4063
|
-
getAutoExecutingMessageIds(): Iterable<MessageId>;
|
|
4064
4039
|
};
|
|
4065
4040
|
declare function createStore_forUserAiChats(): {
|
|
4066
4041
|
getChatById: (chatId: string) => AiChat | undefined;
|
|
@@ -4914,4 +4889,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
|
|
|
4914
4889
|
[K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
|
|
4915
4890
|
};
|
|
4916
4891
|
|
|
4917
|
-
export { type AckOp, type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type
|
|
4892
|
+
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, findLastIndex, freeze, generateUrl, getMentionsFromCommentBody, getSubscriptionKey, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isPlainObject, isRootCrdt, isStartsWithOperator, isUrl, 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
|
@@ -3449,7 +3449,6 @@ declare const brand: unique symbol;
|
|
|
3449
3449
|
type Brand<T, TBrand extends string> = T & {
|
|
3450
3450
|
[brand]: TBrand;
|
|
3451
3451
|
};
|
|
3452
|
-
type ISODateString = Brand<string, "ISODateString">;
|
|
3453
3452
|
type DistributiveOmit<T, K extends PropertyKey> = T extends any ? Omit<T, K> : never;
|
|
3454
3453
|
type WithRequired<T, K extends keyof T> = T & {
|
|
3455
3454
|
[P in K]-?: T[P];
|
|
@@ -3520,6 +3519,7 @@ declare function memoizeOnSuccess<T>(factoryFn: () => Promise<T>): () => Promise
|
|
|
3520
3519
|
declare function findLastIndex<T>(arr: T[], predicate: (value: T, index: number, obj: T[]) => boolean): number;
|
|
3521
3520
|
|
|
3522
3521
|
type Cursor = Brand<string, "Cursor">;
|
|
3522
|
+
type ISODateString = Brand<string, "ISODateString">;
|
|
3523
3523
|
type ChatId = string;
|
|
3524
3524
|
type MessageId = Brand<`ms_${string}`, "MessageId">;
|
|
3525
3525
|
type CmdId = Brand<string, "CmdId">;
|
|
@@ -3796,8 +3796,6 @@ type AiToolInvocationDelta = {
|
|
|
3796
3796
|
type AiReasoningPart = {
|
|
3797
3797
|
type: "reasoning";
|
|
3798
3798
|
text: string;
|
|
3799
|
-
startedAt: ISODateString;
|
|
3800
|
-
endedAt?: ISODateString;
|
|
3801
3799
|
};
|
|
3802
3800
|
type AiUploadedImagePart = {
|
|
3803
3801
|
type: "image";
|
|
@@ -3806,21 +3804,9 @@ type AiUploadedImagePart = {
|
|
|
3806
3804
|
size: number;
|
|
3807
3805
|
mimeType: string;
|
|
3808
3806
|
};
|
|
3809
|
-
/**
|
|
3810
|
-
* Represents a pending or completed knowledge retrieval operation.
|
|
3811
|
-
* Since protocol V6.
|
|
3812
|
-
*/
|
|
3813
|
-
type AiRetrievalPart = {
|
|
3814
|
-
type: "retrieval";
|
|
3815
|
-
kind: "knowledge";
|
|
3816
|
-
id: string;
|
|
3817
|
-
query: string;
|
|
3818
|
-
startedAt: ISODateString;
|
|
3819
|
-
endedAt?: ISODateString;
|
|
3820
|
-
};
|
|
3821
3807
|
type AiUserContentPart = AiTextPart | AiUploadedImagePart;
|
|
3822
|
-
type AiAssistantContentPart = AiReasoningPart | AiTextPart | AiToolInvocationPart
|
|
3823
|
-
type AiAssistantDeltaUpdate = AiTextDelta | AiReasoningDelta | AiExecutingToolInvocationPart | AiToolInvocationStreamStart | AiToolInvocationDelta
|
|
3808
|
+
type AiAssistantContentPart = AiReasoningPart | AiTextPart | AiToolInvocationPart;
|
|
3809
|
+
type AiAssistantDeltaUpdate = AiTextDelta | AiReasoningDelta | AiExecutingToolInvocationPart | AiToolInvocationStreamStart | AiToolInvocationDelta;
|
|
3824
3810
|
type AiUserMessage = {
|
|
3825
3811
|
id: MessageId;
|
|
3826
3812
|
chatId: ChatId;
|
|
@@ -4050,17 +4036,6 @@ declare function createStore_forChatMessages(toolsStore: ReturnType<typeof creat
|
|
|
4050
4036
|
addDelta: (messageId: MessageId, delta: AiAssistantDeltaUpdate) => void;
|
|
4051
4037
|
failAllPending: () => void;
|
|
4052
4038
|
markMine(messageId: MessageId): void;
|
|
4053
|
-
/**
|
|
4054
|
-
* Iterates over all my auto-executing messages.
|
|
4055
|
-
*
|
|
4056
|
-
* These are messages that match all these conditions:
|
|
4057
|
-
* - The message is an assistant message
|
|
4058
|
-
* - The message is owned by this client ("mine")
|
|
4059
|
-
* - The message is currently in "awaiting-tool" status
|
|
4060
|
-
* - The message has at least one tool invocation in "executing" stage
|
|
4061
|
-
* - The tool invocation has an execute() function defined
|
|
4062
|
-
*/
|
|
4063
|
-
getAutoExecutingMessageIds(): Iterable<MessageId>;
|
|
4064
4039
|
};
|
|
4065
4040
|
declare function createStore_forUserAiChats(): {
|
|
4066
4041
|
getChatById: (chatId: string) => AiChat | undefined;
|
|
@@ -4914,4 +4889,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
|
|
|
4914
4889
|
[K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
|
|
4915
4890
|
};
|
|
4916
4891
|
|
|
4917
|
-
export { type AckOp, type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type
|
|
4892
|
+
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, findLastIndex, freeze, generateUrl, getMentionsFromCommentBody, getSubscriptionKey, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isPlainObject, isRootCrdt, isStartsWithOperator, isUrl, 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.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 = "3.5.
|
|
9
|
+
var PKG_VERSION = "3.5.4";
|
|
10
10
|
var PKG_FORMAT = "esm";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -3987,34 +3987,13 @@ var IncrementalJsonParser = class {
|
|
|
3987
3987
|
};
|
|
3988
3988
|
|
|
3989
3989
|
// src/types/ai.ts
|
|
3990
|
-
function replaceOrAppend(content, newItem, keyFn, now2) {
|
|
3991
|
-
const existingIndex = findLastIndex(
|
|
3992
|
-
content,
|
|
3993
|
-
(item) => item.type === newItem.type && keyFn(item) === keyFn(newItem)
|
|
3994
|
-
);
|
|
3995
|
-
if (existingIndex > -1) {
|
|
3996
|
-
content[existingIndex] = newItem;
|
|
3997
|
-
} else {
|
|
3998
|
-
closePart(content[content.length - 1], now2);
|
|
3999
|
-
content.push(newItem);
|
|
4000
|
-
}
|
|
4001
|
-
}
|
|
4002
|
-
function closePart(prevPart, endedAt) {
|
|
4003
|
-
if (prevPart?.type === "reasoning") {
|
|
4004
|
-
prevPart.endedAt ??= endedAt;
|
|
4005
|
-
}
|
|
4006
|
-
}
|
|
4007
3990
|
function patchContentWithDelta(content, delta) {
|
|
4008
|
-
if (delta === null)
|
|
4009
|
-
return;
|
|
4010
|
-
const now2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
4011
3991
|
const lastPart = content[content.length - 1];
|
|
4012
3992
|
switch (delta.type) {
|
|
4013
3993
|
case "text-delta":
|
|
4014
3994
|
if (lastPart?.type === "text") {
|
|
4015
3995
|
lastPart.text += delta.textDelta;
|
|
4016
3996
|
} else {
|
|
4017
|
-
closePart(lastPart, now2);
|
|
4018
3997
|
content.push({ type: "text", text: delta.textDelta });
|
|
4019
3998
|
}
|
|
4020
3999
|
break;
|
|
@@ -4022,11 +4001,9 @@ function patchContentWithDelta(content, delta) {
|
|
|
4022
4001
|
if (lastPart?.type === "reasoning") {
|
|
4023
4002
|
lastPart.text += delta.textDelta;
|
|
4024
4003
|
} else {
|
|
4025
|
-
closePart(lastPart, now2);
|
|
4026
4004
|
content.push({
|
|
4027
4005
|
type: "reasoning",
|
|
4028
|
-
text: delta.textDelta ?? ""
|
|
4029
|
-
startedAt: now2
|
|
4006
|
+
text: delta.textDelta ?? ""
|
|
4030
4007
|
});
|
|
4031
4008
|
}
|
|
4032
4009
|
break;
|
|
@@ -4044,12 +4021,18 @@ function patchContentWithDelta(content, delta) {
|
|
|
4044
4021
|
}
|
|
4045
4022
|
break;
|
|
4046
4023
|
}
|
|
4047
|
-
case "tool-invocation":
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4024
|
+
case "tool-invocation": {
|
|
4025
|
+
const existingIndex = findLastIndex(
|
|
4026
|
+
content,
|
|
4027
|
+
(part) => part.type === "tool-invocation" && part.invocationId === delta.invocationId
|
|
4028
|
+
);
|
|
4029
|
+
if (existingIndex > -1) {
|
|
4030
|
+
content[existingIndex] = delta;
|
|
4031
|
+
} else {
|
|
4032
|
+
content.push(delta);
|
|
4033
|
+
}
|
|
4052
4034
|
break;
|
|
4035
|
+
}
|
|
4053
4036
|
default:
|
|
4054
4037
|
return assertNever(delta, "Unhandled case");
|
|
4055
4038
|
}
|
|
@@ -4061,20 +4044,16 @@ function createReceivingToolInvocation(invocationId, name, partialArgsText = "")
|
|
|
4061
4044
|
stage: "receiving",
|
|
4062
4045
|
invocationId,
|
|
4063
4046
|
name,
|
|
4064
|
-
// --- Alternative implementation for FRONTEND only ------------------------
|
|
4065
4047
|
get partialArgsText() {
|
|
4066
4048
|
return parser.source;
|
|
4067
4049
|
},
|
|
4068
|
-
// prettier-ignore
|
|
4069
4050
|
get partialArgs() {
|
|
4070
4051
|
return parser.json;
|
|
4071
4052
|
},
|
|
4072
|
-
//
|
|
4053
|
+
// Internal method to append deltas
|
|
4073
4054
|
__appendDelta(delta) {
|
|
4074
4055
|
parser.append(delta);
|
|
4075
4056
|
}
|
|
4076
|
-
// prettier-ignore
|
|
4077
|
-
// ------------------------------------------------------------------------
|
|
4078
4057
|
};
|
|
4079
4058
|
}
|
|
4080
4059
|
|
|
@@ -4476,33 +4455,6 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
|
|
|
4476
4455
|
failAllPending,
|
|
4477
4456
|
markMine(messageId) {
|
|
4478
4457
|
myMessages.add(messageId);
|
|
4479
|
-
},
|
|
4480
|
-
/**
|
|
4481
|
-
* Iterates over all my auto-executing messages.
|
|
4482
|
-
*
|
|
4483
|
-
* These are messages that match all these conditions:
|
|
4484
|
-
* - The message is an assistant message
|
|
4485
|
-
* - The message is owned by this client ("mine")
|
|
4486
|
-
* - The message is currently in "awaiting-tool" status
|
|
4487
|
-
* - The message has at least one tool invocation in "executing" stage
|
|
4488
|
-
* - The tool invocation has an execute() function defined
|
|
4489
|
-
*/
|
|
4490
|
-
*getAutoExecutingMessageIds() {
|
|
4491
|
-
for (const messageId of myMessages) {
|
|
4492
|
-
const message = getMessageById(messageId);
|
|
4493
|
-
if (message?.role === "assistant" && message.status === "awaiting-tool") {
|
|
4494
|
-
const isAutoExecuting = message.contentSoFar.some((part) => {
|
|
4495
|
-
if (part.type === "tool-invocation" && part.stage === "executing") {
|
|
4496
|
-
const tool = toolsStore.getTool\u03A3(part.name, message.chatId).get();
|
|
4497
|
-
return typeof tool?.execute === "function";
|
|
4498
|
-
}
|
|
4499
|
-
return false;
|
|
4500
|
-
});
|
|
4501
|
-
if (isAutoExecuting) {
|
|
4502
|
-
yield message.id;
|
|
4503
|
-
}
|
|
4504
|
-
}
|
|
4505
|
-
}
|
|
4506
4458
|
}
|
|
4507
4459
|
};
|
|
4508
4460
|
}
|
|
@@ -4814,14 +4766,6 @@ function createAi(config) {
|
|
|
4814
4766
|
messagesStore.markMine(resp.message.id);
|
|
4815
4767
|
}
|
|
4816
4768
|
}
|
|
4817
|
-
function handleBeforeUnload() {
|
|
4818
|
-
for (const messageId of context.messagesStore.getAutoExecutingMessageIds()) {
|
|
4819
|
-
sendClientMsgWithResponse({ cmd: "abort-ai", messageId }).catch(() => {
|
|
4820
|
-
});
|
|
4821
|
-
}
|
|
4822
|
-
}
|
|
4823
|
-
const win = typeof window !== "undefined" ? window : void 0;
|
|
4824
|
-
win?.addEventListener("beforeunload", handleBeforeUnload, { once: true });
|
|
4825
4769
|
return Object.defineProperty(
|
|
4826
4770
|
{
|
|
4827
4771
|
[kInternal]: {
|
|
@@ -4889,7 +4833,7 @@ function makeCreateSocketDelegateForAi(baseUrl, WebSocketPolyfill) {
|
|
|
4889
4833
|
}
|
|
4890
4834
|
const url2 = new URL(baseUrl);
|
|
4891
4835
|
url2.protocol = url2.protocol === "http:" ? "ws" : "wss";
|
|
4892
|
-
url2.pathname = "/ai/
|
|
4836
|
+
url2.pathname = "/ai/v5";
|
|
4893
4837
|
if (authValue.type === "secret") {
|
|
4894
4838
|
url2.searchParams.set("tok", authValue.token.raw);
|
|
4895
4839
|
} else if (authValue.type === "public") {
|