@liveblocks/core 3.3.3 → 3.4.0-alpha1
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 +256 -103
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -3
- package/dist/index.d.ts +24 -3
- package/dist/index.js +161 -8
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.d.cts
CHANGED
|
@@ -3513,6 +3513,10 @@ declare function withTimeout<T>(promise: Promise<T>, millis: number, errmsg: str
|
|
|
3513
3513
|
* memoized value.
|
|
3514
3514
|
*/
|
|
3515
3515
|
declare function memoizeOnSuccess<T>(factoryFn: () => Promise<T>): () => Promise<T>;
|
|
3516
|
+
/**
|
|
3517
|
+
* Polyfill for Array.prototype.findLastIndex()
|
|
3518
|
+
*/
|
|
3519
|
+
declare function findLastIndex<T>(arr: T[], predicate: (value: T, index: number, obj: T[]) => boolean): number;
|
|
3516
3520
|
|
|
3517
3521
|
type Cursor = Brand<string, "Cursor">;
|
|
3518
3522
|
type ISODateString = Brand<string, "ISODateString">;
|
|
@@ -3743,7 +3747,7 @@ type AiReceivingToolInvocationPart = {
|
|
|
3743
3747
|
stage: "receiving";
|
|
3744
3748
|
invocationId: string;
|
|
3745
3749
|
name: string;
|
|
3746
|
-
partialArgs:
|
|
3750
|
+
partialArgs: JsonObject;
|
|
3747
3751
|
};
|
|
3748
3752
|
type AiExecutingToolInvocationPart<A extends JsonObject = JsonObject> = {
|
|
3749
3753
|
type: "tool-invocation";
|
|
@@ -3775,6 +3779,20 @@ type AiReasoningDelta = Relax<{
|
|
|
3775
3779
|
type: "reasoning-delta";
|
|
3776
3780
|
signature: string;
|
|
3777
3781
|
}>;
|
|
3782
|
+
type AiToolInvocationStreamStart = {
|
|
3783
|
+
type: "tool-stream";
|
|
3784
|
+
invocationId: string;
|
|
3785
|
+
name: string;
|
|
3786
|
+
};
|
|
3787
|
+
type AiToolInvocationDelta = {
|
|
3788
|
+
type: "tool-delta";
|
|
3789
|
+
/**
|
|
3790
|
+
* The textual delta to be appended to the last tool invocation stream's
|
|
3791
|
+
* partial JSON buffer that will eventually become the full `args` value when
|
|
3792
|
+
* JSON.parse()'ed.
|
|
3793
|
+
*/
|
|
3794
|
+
delta: string;
|
|
3795
|
+
};
|
|
3778
3796
|
type AiReasoningPart = {
|
|
3779
3797
|
type: "reasoning";
|
|
3780
3798
|
text: string;
|
|
@@ -3788,7 +3806,7 @@ type AiUploadedImagePart = {
|
|
|
3788
3806
|
};
|
|
3789
3807
|
type AiUserContentPart = AiTextPart | AiUploadedImagePart;
|
|
3790
3808
|
type AiAssistantContentPart = AiReasoningPart | AiTextPart | AiToolInvocationPart;
|
|
3791
|
-
type AiAssistantDeltaUpdate = AiTextDelta | AiReasoningDelta | AiExecutingToolInvocationPart;
|
|
3809
|
+
type AiAssistantDeltaUpdate = AiTextDelta | AiReasoningDelta | AiExecutingToolInvocationPart | AiToolInvocationStreamStart | AiToolInvocationDelta;
|
|
3792
3810
|
type AiUserMessage = {
|
|
3793
3811
|
id: MessageId;
|
|
3794
3812
|
chatId: ChatId;
|
|
@@ -3931,6 +3949,7 @@ type AiToolInvocationProps<A extends JsonObject, R extends JsonObject> = Resolve
|
|
|
3931
3949
|
types: AiToolTypePack<A, R>;
|
|
3932
3950
|
[kInternal]: {
|
|
3933
3951
|
execute: AiToolExecuteCallback<A, R> | undefined;
|
|
3952
|
+
messageStatus: AiAssistantMessage["status"];
|
|
3934
3953
|
};
|
|
3935
3954
|
}>;
|
|
3936
3955
|
type AiOpaqueToolInvocationProps = AiToolInvocationProps<JsonObject, JsonObject>;
|
|
@@ -4719,6 +4738,7 @@ declare function url(strings: TemplateStringsArray, ...values: string[]): URLSaf
|
|
|
4719
4738
|
* - Absolute URLs with an http or https protocol (e.g. https://liveblocks.io)
|
|
4720
4739
|
* - Absolute URLs with a `www` prefix (e.g. www.liveblocks.io)
|
|
4721
4740
|
* - Relative URLs (e.g. /path/to/page)
|
|
4741
|
+
* - Hash-only URLs (e.g. #hash)
|
|
4722
4742
|
*
|
|
4723
4743
|
* The presence/absence of trailing slashes is preserved.
|
|
4724
4744
|
* Rejected URLs are returned as `null`.
|
|
@@ -4728,6 +4748,7 @@ declare function sanitizeUrl(url: string): string | null;
|
|
|
4728
4748
|
* Construct a URL with optional parameters and hash.
|
|
4729
4749
|
*/
|
|
4730
4750
|
declare function generateUrl(url: string, params?: Record<string, string | number | undefined>, hash?: string): string;
|
|
4751
|
+
declare function isUrl(string: string): boolean;
|
|
4731
4752
|
|
|
4732
4753
|
/**
|
|
4733
4754
|
* Definition of all messages the Panel can send to the Client.
|
|
@@ -4861,4 +4882,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
|
|
|
4861
4882
|
[K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
|
|
4862
4883
|
};
|
|
4863
4884
|
|
|
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 };
|
|
4885
|
+
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
|
@@ -3513,6 +3513,10 @@ declare function withTimeout<T>(promise: Promise<T>, millis: number, errmsg: str
|
|
|
3513
3513
|
* memoized value.
|
|
3514
3514
|
*/
|
|
3515
3515
|
declare function memoizeOnSuccess<T>(factoryFn: () => Promise<T>): () => Promise<T>;
|
|
3516
|
+
/**
|
|
3517
|
+
* Polyfill for Array.prototype.findLastIndex()
|
|
3518
|
+
*/
|
|
3519
|
+
declare function findLastIndex<T>(arr: T[], predicate: (value: T, index: number, obj: T[]) => boolean): number;
|
|
3516
3520
|
|
|
3517
3521
|
type Cursor = Brand<string, "Cursor">;
|
|
3518
3522
|
type ISODateString = Brand<string, "ISODateString">;
|
|
@@ -3743,7 +3747,7 @@ type AiReceivingToolInvocationPart = {
|
|
|
3743
3747
|
stage: "receiving";
|
|
3744
3748
|
invocationId: string;
|
|
3745
3749
|
name: string;
|
|
3746
|
-
partialArgs:
|
|
3750
|
+
partialArgs: JsonObject;
|
|
3747
3751
|
};
|
|
3748
3752
|
type AiExecutingToolInvocationPart<A extends JsonObject = JsonObject> = {
|
|
3749
3753
|
type: "tool-invocation";
|
|
@@ -3775,6 +3779,20 @@ type AiReasoningDelta = Relax<{
|
|
|
3775
3779
|
type: "reasoning-delta";
|
|
3776
3780
|
signature: string;
|
|
3777
3781
|
}>;
|
|
3782
|
+
type AiToolInvocationStreamStart = {
|
|
3783
|
+
type: "tool-stream";
|
|
3784
|
+
invocationId: string;
|
|
3785
|
+
name: string;
|
|
3786
|
+
};
|
|
3787
|
+
type AiToolInvocationDelta = {
|
|
3788
|
+
type: "tool-delta";
|
|
3789
|
+
/**
|
|
3790
|
+
* The textual delta to be appended to the last tool invocation stream's
|
|
3791
|
+
* partial JSON buffer that will eventually become the full `args` value when
|
|
3792
|
+
* JSON.parse()'ed.
|
|
3793
|
+
*/
|
|
3794
|
+
delta: string;
|
|
3795
|
+
};
|
|
3778
3796
|
type AiReasoningPart = {
|
|
3779
3797
|
type: "reasoning";
|
|
3780
3798
|
text: string;
|
|
@@ -3788,7 +3806,7 @@ type AiUploadedImagePart = {
|
|
|
3788
3806
|
};
|
|
3789
3807
|
type AiUserContentPart = AiTextPart | AiUploadedImagePart;
|
|
3790
3808
|
type AiAssistantContentPart = AiReasoningPart | AiTextPart | AiToolInvocationPart;
|
|
3791
|
-
type AiAssistantDeltaUpdate = AiTextDelta | AiReasoningDelta | AiExecutingToolInvocationPart;
|
|
3809
|
+
type AiAssistantDeltaUpdate = AiTextDelta | AiReasoningDelta | AiExecutingToolInvocationPart | AiToolInvocationStreamStart | AiToolInvocationDelta;
|
|
3792
3810
|
type AiUserMessage = {
|
|
3793
3811
|
id: MessageId;
|
|
3794
3812
|
chatId: ChatId;
|
|
@@ -3931,6 +3949,7 @@ type AiToolInvocationProps<A extends JsonObject, R extends JsonObject> = Resolve
|
|
|
3931
3949
|
types: AiToolTypePack<A, R>;
|
|
3932
3950
|
[kInternal]: {
|
|
3933
3951
|
execute: AiToolExecuteCallback<A, R> | undefined;
|
|
3952
|
+
messageStatus: AiAssistantMessage["status"];
|
|
3934
3953
|
};
|
|
3935
3954
|
}>;
|
|
3936
3955
|
type AiOpaqueToolInvocationProps = AiToolInvocationProps<JsonObject, JsonObject>;
|
|
@@ -4719,6 +4738,7 @@ declare function url(strings: TemplateStringsArray, ...values: string[]): URLSaf
|
|
|
4719
4738
|
* - Absolute URLs with an http or https protocol (e.g. https://liveblocks.io)
|
|
4720
4739
|
* - Absolute URLs with a `www` prefix (e.g. www.liveblocks.io)
|
|
4721
4740
|
* - Relative URLs (e.g. /path/to/page)
|
|
4741
|
+
* - Hash-only URLs (e.g. #hash)
|
|
4722
4742
|
*
|
|
4723
4743
|
* The presence/absence of trailing slashes is preserved.
|
|
4724
4744
|
* Rejected URLs are returned as `null`.
|
|
@@ -4728,6 +4748,7 @@ declare function sanitizeUrl(url: string): string | null;
|
|
|
4728
4748
|
* Construct a URL with optional parameters and hash.
|
|
4729
4749
|
*/
|
|
4730
4750
|
declare function generateUrl(url: string, params?: Record<string, string | number | undefined>, hash?: string): string;
|
|
4751
|
+
declare function isUrl(string: string): boolean;
|
|
4731
4752
|
|
|
4732
4753
|
/**
|
|
4733
4754
|
* Definition of all messages the Panel can send to the Client.
|
|
@@ -4861,4 +4882,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
|
|
|
4861
4882
|
[K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
|
|
4862
4883
|
};
|
|
4863
4884
|
|
|
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 };
|
|
4885
|
+
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.
|
|
9
|
+
var PKG_VERSION = "3.4.0-alpha1";
|
|
10
10
|
var PKG_FORMAT = "esm";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -243,6 +243,14 @@ function memoizeOnSuccess(factoryFn) {
|
|
|
243
243
|
return cached;
|
|
244
244
|
};
|
|
245
245
|
}
|
|
246
|
+
function findLastIndex(arr, predicate) {
|
|
247
|
+
for (let i = arr.length - 1; i >= 0; i--) {
|
|
248
|
+
if (predicate(arr[i], i, arr)) {
|
|
249
|
+
return i;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return -1;
|
|
253
|
+
}
|
|
246
254
|
|
|
247
255
|
// src/lib/signals.ts
|
|
248
256
|
var kSinks = Symbol("kSinks");
|
|
@@ -1332,6 +1340,9 @@ function sanitizeUrl(url2) {
|
|
|
1332
1340
|
if (url2.startsWith("www.")) {
|
|
1333
1341
|
url2 = "https://" + url2;
|
|
1334
1342
|
}
|
|
1343
|
+
if (url2 === "#") {
|
|
1344
|
+
return url2;
|
|
1345
|
+
}
|
|
1335
1346
|
try {
|
|
1336
1347
|
const isAbsolute = ABSOLUTE_URL_REGEX.test(url2);
|
|
1337
1348
|
const urlObject = new URL(
|
|
@@ -1375,6 +1386,14 @@ function generateUrl(url2, params, hash) {
|
|
|
1375
1386
|
}
|
|
1376
1387
|
return isAbsolute ? urlObject.href : urlObject.href.replace(PLACEHOLDER_BASE_URL, "");
|
|
1377
1388
|
}
|
|
1389
|
+
function isUrl(string) {
|
|
1390
|
+
try {
|
|
1391
|
+
new URL(string);
|
|
1392
|
+
return true;
|
|
1393
|
+
} catch (_) {
|
|
1394
|
+
return false;
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1378
1397
|
|
|
1379
1398
|
// src/api-client.ts
|
|
1380
1399
|
function createApiClient({
|
|
@@ -3798,8 +3817,102 @@ function parseAuthToken(rawTokenString) {
|
|
|
3798
3817
|
};
|
|
3799
3818
|
}
|
|
3800
3819
|
|
|
3820
|
+
// src/lib/parsePartialJsonObject.ts
|
|
3821
|
+
function parsePartialJsonObject(partial) {
|
|
3822
|
+
partial = partial.trimStart();
|
|
3823
|
+
if (partial.charAt(0) !== "{") {
|
|
3824
|
+
return {};
|
|
3825
|
+
}
|
|
3826
|
+
if (partial.trimEnd().endsWith("}")) {
|
|
3827
|
+
const quickCheck = tryParseJson(partial);
|
|
3828
|
+
if (quickCheck) {
|
|
3829
|
+
return quickCheck;
|
|
3830
|
+
}
|
|
3831
|
+
}
|
|
3832
|
+
let result = partial;
|
|
3833
|
+
let quoteCount = 0;
|
|
3834
|
+
let escaped = false;
|
|
3835
|
+
for (let i = 0; i < result.length; i++) {
|
|
3836
|
+
const char = result[i];
|
|
3837
|
+
if (escaped) {
|
|
3838
|
+
escaped = false;
|
|
3839
|
+
} else if (char === "\\") {
|
|
3840
|
+
escaped = true;
|
|
3841
|
+
} else if (char === '"') {
|
|
3842
|
+
quoteCount++;
|
|
3843
|
+
}
|
|
3844
|
+
}
|
|
3845
|
+
if (quoteCount % 2 === 1) {
|
|
3846
|
+
result += '"';
|
|
3847
|
+
}
|
|
3848
|
+
result = result.trimEnd();
|
|
3849
|
+
if (result.endsWith(",")) {
|
|
3850
|
+
result = result.slice(0, -1);
|
|
3851
|
+
}
|
|
3852
|
+
if (result.endsWith(".")) {
|
|
3853
|
+
result = result.slice(0, -1);
|
|
3854
|
+
}
|
|
3855
|
+
const stack = [];
|
|
3856
|
+
let inString = false;
|
|
3857
|
+
escaped = false;
|
|
3858
|
+
for (let i = 0; i < result.length; i++) {
|
|
3859
|
+
const char = result[i];
|
|
3860
|
+
if (inString) {
|
|
3861
|
+
if (escaped) {
|
|
3862
|
+
escaped = false;
|
|
3863
|
+
} else if (char === "\\") {
|
|
3864
|
+
escaped = true;
|
|
3865
|
+
} else if (char === '"') {
|
|
3866
|
+
inString = false;
|
|
3867
|
+
}
|
|
3868
|
+
} else {
|
|
3869
|
+
if (char === '"') {
|
|
3870
|
+
inString = true;
|
|
3871
|
+
} else if (char === "{") {
|
|
3872
|
+
stack.push("}");
|
|
3873
|
+
} else if (char === "[") {
|
|
3874
|
+
stack.push("]");
|
|
3875
|
+
} else if (char === "}" && stack.length > 0 && stack[stack.length - 1] === "}") {
|
|
3876
|
+
stack.pop();
|
|
3877
|
+
} else if (char === "]" && stack.length > 0 && stack[stack.length - 1] === "]") {
|
|
3878
|
+
stack.pop();
|
|
3879
|
+
}
|
|
3880
|
+
}
|
|
3881
|
+
}
|
|
3882
|
+
const suffix = stack.reverse().join("");
|
|
3883
|
+
{
|
|
3884
|
+
const attempt = tryParseJson(result + suffix);
|
|
3885
|
+
if (attempt) {
|
|
3886
|
+
return attempt;
|
|
3887
|
+
}
|
|
3888
|
+
}
|
|
3889
|
+
if (result.endsWith(":")) {
|
|
3890
|
+
result = result.slice(0, -1);
|
|
3891
|
+
}
|
|
3892
|
+
if (result.endsWith('"')) {
|
|
3893
|
+
let pos = result.length - 2;
|
|
3894
|
+
escaped = false;
|
|
3895
|
+
while (pos >= 0) {
|
|
3896
|
+
if (escaped) {
|
|
3897
|
+
escaped = false;
|
|
3898
|
+
} else if (result[pos] === "\\") {
|
|
3899
|
+
escaped = true;
|
|
3900
|
+
} else if (result[pos] === '"') {
|
|
3901
|
+
result = result.slice(0, pos);
|
|
3902
|
+
break;
|
|
3903
|
+
}
|
|
3904
|
+
pos--;
|
|
3905
|
+
}
|
|
3906
|
+
}
|
|
3907
|
+
if (result.endsWith(",")) {
|
|
3908
|
+
result = result.slice(0, -1);
|
|
3909
|
+
}
|
|
3910
|
+
result += suffix;
|
|
3911
|
+
return tryParseJson(result) ?? {};
|
|
3912
|
+
}
|
|
3913
|
+
|
|
3801
3914
|
// src/types/ai.ts
|
|
3802
|
-
function
|
|
3915
|
+
function patchContentWithDelta(content, delta) {
|
|
3803
3916
|
const lastPart = content[content.length - 1];
|
|
3804
3917
|
switch (delta.type) {
|
|
3805
3918
|
case "text-delta":
|
|
@@ -3819,9 +3932,44 @@ function appendDelta(content, delta) {
|
|
|
3819
3932
|
});
|
|
3820
3933
|
}
|
|
3821
3934
|
break;
|
|
3822
|
-
case "tool-
|
|
3823
|
-
|
|
3935
|
+
case "tool-stream": {
|
|
3936
|
+
let _cacheKey = "";
|
|
3937
|
+
let _cachedArgs = {};
|
|
3938
|
+
const toolInvocation = {
|
|
3939
|
+
type: "tool-invocation",
|
|
3940
|
+
stage: "receiving",
|
|
3941
|
+
invocationId: delta.invocationId,
|
|
3942
|
+
name: delta.name,
|
|
3943
|
+
partialArgsText: "",
|
|
3944
|
+
get partialArgs() {
|
|
3945
|
+
if (this.partialArgsText !== _cacheKey) {
|
|
3946
|
+
_cachedArgs = parsePartialJsonObject(this.partialArgsText);
|
|
3947
|
+
_cacheKey = this.partialArgsText;
|
|
3948
|
+
}
|
|
3949
|
+
return _cachedArgs;
|
|
3950
|
+
}
|
|
3951
|
+
};
|
|
3952
|
+
content.push(toolInvocation);
|
|
3953
|
+
break;
|
|
3954
|
+
}
|
|
3955
|
+
case "tool-delta": {
|
|
3956
|
+
if (lastPart?.type === "tool-invocation" && lastPart.stage === "receiving") {
|
|
3957
|
+
lastPart.partialArgsText += delta.delta;
|
|
3958
|
+
}
|
|
3959
|
+
break;
|
|
3960
|
+
}
|
|
3961
|
+
case "tool-invocation": {
|
|
3962
|
+
const existingIndex = findLastIndex(
|
|
3963
|
+
content,
|
|
3964
|
+
(part) => part.type === "tool-invocation" && part.invocationId === delta.invocationId
|
|
3965
|
+
);
|
|
3966
|
+
if (existingIndex > -1) {
|
|
3967
|
+
content[existingIndex] = delta;
|
|
3968
|
+
} else {
|
|
3969
|
+
content.push(delta);
|
|
3970
|
+
}
|
|
3824
3971
|
break;
|
|
3972
|
+
}
|
|
3825
3973
|
default:
|
|
3826
3974
|
return assertNever(delta, "Unhandled case");
|
|
3827
3975
|
}
|
|
@@ -4063,7 +4211,10 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
|
|
|
4063
4211
|
}
|
|
4064
4212
|
}
|
|
4065
4213
|
} else {
|
|
4066
|
-
|
|
4214
|
+
if (message.role === "assistant" && message.status === "generating") {
|
|
4215
|
+
} else {
|
|
4216
|
+
myMessages.delete(message.id);
|
|
4217
|
+
}
|
|
4067
4218
|
}
|
|
4068
4219
|
});
|
|
4069
4220
|
}
|
|
@@ -4071,7 +4222,7 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
|
|
|
4071
4222
|
generatingMessages\u03A3.mutate((lut) => {
|
|
4072
4223
|
const message = lut.get(messageId);
|
|
4073
4224
|
if (message === void 0) return false;
|
|
4074
|
-
|
|
4225
|
+
patchContentWithDelta(message.contentSoFar, delta);
|
|
4075
4226
|
lut.set(messageId, message);
|
|
4076
4227
|
return true;
|
|
4077
4228
|
});
|
|
@@ -4520,6 +4671,7 @@ function createAi(config) {
|
|
|
4520
4671
|
const requestKnowledge = options?.knowledge || [];
|
|
4521
4672
|
const combinedKnowledge = [...globalKnowledge, ...requestKnowledge];
|
|
4522
4673
|
const tools = context.toolsStore.getToolDescriptions(chatId);
|
|
4674
|
+
messagesStore.markMine(targetMessageId);
|
|
4523
4675
|
const resp = await sendClientMsgWithResponse({
|
|
4524
4676
|
cmd: "ask-in-chat",
|
|
4525
4677
|
chatId,
|
|
@@ -4534,7 +4686,6 @@ function createAi(config) {
|
|
|
4534
4686
|
tools: tools.length > 0 ? tools : void 0
|
|
4535
4687
|
}
|
|
4536
4688
|
});
|
|
4537
|
-
messagesStore.markMine(resp.targetMessage.id);
|
|
4538
4689
|
return resp;
|
|
4539
4690
|
},
|
|
4540
4691
|
abort: (messageId) => sendClientMsgWithResponse({ cmd: "abort-ai", messageId }),
|
|
@@ -4565,7 +4716,7 @@ function makeCreateSocketDelegateForAi(baseUrl, WebSocketPolyfill) {
|
|
|
4565
4716
|
}
|
|
4566
4717
|
const url2 = new URL(baseUrl);
|
|
4567
4718
|
url2.protocol = url2.protocol === "http:" ? "ws" : "wss";
|
|
4568
|
-
url2.pathname = "/ai/
|
|
4719
|
+
url2.pathname = "/ai/v5";
|
|
4569
4720
|
if (authValue.type === "secret") {
|
|
4570
4721
|
url2.searchParams.set("tok", authValue.token.raw);
|
|
4571
4722
|
} else if (authValue.type === "public") {
|
|
@@ -10772,6 +10923,7 @@ export {
|
|
|
10772
10923
|
detectDupes,
|
|
10773
10924
|
entries,
|
|
10774
10925
|
errorIf,
|
|
10926
|
+
findLastIndex,
|
|
10775
10927
|
freeze,
|
|
10776
10928
|
generateUrl,
|
|
10777
10929
|
getMentionsFromCommentBody,
|
|
@@ -10790,6 +10942,7 @@ export {
|
|
|
10790
10942
|
isPlainObject,
|
|
10791
10943
|
isRootCrdt,
|
|
10792
10944
|
isStartsWithOperator,
|
|
10945
|
+
isUrl,
|
|
10793
10946
|
kInternal,
|
|
10794
10947
|
keys,
|
|
10795
10948
|
legacy_patchImmutableObject,
|