@liveblocks/core 2.25.0-aiprivatebeta5 → 2.25.0-aiprivatebeta7
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 +154 -165
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +58 -53
- package/dist/index.d.ts +58 -53
- package/dist/index.js +69 -80
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -3540,16 +3540,15 @@ type DefineCmd<CmdName extends string, TRequest, TResponse> = [
|
|
|
3540
3540
|
cmdId: CmdId;
|
|
3541
3541
|
} & TResponse>
|
|
3542
3542
|
];
|
|
3543
|
-
type CommandPair = GetChatsPair |
|
|
3543
|
+
type CommandPair = GetChatsPair | GetOrCreateChatPair | DeleteChatPair | GetMessageTreePair | DeleteMessagePair | ClearChatPair | AskInChatPair | AbortAiPair;
|
|
3544
3544
|
type ServerCmdResponse<T extends CommandPair = CommandPair> = T[1];
|
|
3545
3545
|
type GetChatsResponse = ServerCmdResponse<GetChatsPair>;
|
|
3546
|
-
type
|
|
3546
|
+
type GetOrCreateChatResponse = ServerCmdResponse<GetOrCreateChatPair>;
|
|
3547
3547
|
type DeleteChatResponse = ServerCmdResponse<DeleteChatPair>;
|
|
3548
3548
|
type GetMessageTreeResponse = ServerCmdResponse<GetMessageTreePair>;
|
|
3549
|
-
type AddUserMessageResponse = ServerCmdResponse<AddUserMessagePair>;
|
|
3550
3549
|
type DeleteMessageResponse = ServerCmdResponse<DeleteMessagePair>;
|
|
3551
3550
|
type ClearChatResponse = ServerCmdResponse<ClearChatPair>;
|
|
3552
|
-
type
|
|
3551
|
+
type AskInChatResponse = ServerCmdResponse<AskInChatPair>;
|
|
3553
3552
|
type AbortAiResponse = ServerCmdResponse<AbortAiPair>;
|
|
3554
3553
|
type GetChatsPair = DefineCmd<"get-chats", {
|
|
3555
3554
|
cursor?: Cursor;
|
|
@@ -3558,12 +3557,13 @@ type GetChatsPair = DefineCmd<"get-chats", {
|
|
|
3558
3557
|
chats: AiChat[];
|
|
3559
3558
|
nextCursor: Cursor | null;
|
|
3560
3559
|
}>;
|
|
3561
|
-
type
|
|
3562
|
-
|
|
3560
|
+
type CreateChatOptions = {
|
|
3561
|
+
title?: string;
|
|
3562
|
+
metadata?: Record<string, string | string[]>;
|
|
3563
|
+
};
|
|
3564
|
+
type GetOrCreateChatPair = DefineCmd<"get-or-create-chat", {
|
|
3563
3565
|
id: ChatId;
|
|
3564
|
-
|
|
3565
|
-
ephemeral: boolean;
|
|
3566
|
-
metadata: Record<string, string | string[]>;
|
|
3566
|
+
options?: CreateChatOptions;
|
|
3567
3567
|
}, {
|
|
3568
3568
|
chat: AiChat;
|
|
3569
3569
|
}>;
|
|
@@ -3578,14 +3578,6 @@ type GetMessageTreePair = DefineCmd<"get-message-tree", {
|
|
|
3578
3578
|
chat: AiChat;
|
|
3579
3579
|
messages: AiChatMessage[];
|
|
3580
3580
|
}>;
|
|
3581
|
-
type AddUserMessagePair = DefineCmd<"add-user-message", {
|
|
3582
|
-
id: MessageId;
|
|
3583
|
-
chatId: ChatId;
|
|
3584
|
-
parentMessageId: MessageId | null;
|
|
3585
|
-
content: AiUserContentPart[];
|
|
3586
|
-
}, {
|
|
3587
|
-
message: AiUserMessage;
|
|
3588
|
-
}>;
|
|
3589
3581
|
type DeleteMessagePair = DefineCmd<"delete-message", {
|
|
3590
3582
|
chatId: ChatId;
|
|
3591
3583
|
messageId: MessageId;
|
|
@@ -3598,10 +3590,27 @@ type ClearChatPair = DefineCmd<"clear-chat", {
|
|
|
3598
3590
|
}, {
|
|
3599
3591
|
chatId: ChatId;
|
|
3600
3592
|
}>;
|
|
3601
|
-
type
|
|
3593
|
+
type AiGenerationOptions = {
|
|
3594
|
+
/**
|
|
3595
|
+
* The Copilot ID to use for this request. If not provided, a built-in
|
|
3596
|
+
* default Copilot will be used instead of one that you configured via the
|
|
3597
|
+
* dashboard.
|
|
3598
|
+
*/
|
|
3599
|
+
copilotId?: CopilotId;
|
|
3600
|
+
stream: boolean;
|
|
3601
|
+
tools?: AiToolDefinition[];
|
|
3602
|
+
knowledge?: AiKnowledgeSource[];
|
|
3603
|
+
timeout: number;
|
|
3604
|
+
};
|
|
3605
|
+
type AskInChatPair = DefineCmd<"ask-in-chat", {
|
|
3602
3606
|
chatId: ChatId;
|
|
3603
3607
|
/** The chat message to use as the source to create the assistant response. */
|
|
3604
|
-
|
|
3608
|
+
sourceMessage: // An existing message ID to reply to
|
|
3609
|
+
MessageId | {
|
|
3610
|
+
id: MessageId;
|
|
3611
|
+
parentMessageId: MessageId | null;
|
|
3612
|
+
content: AiUserContentPart[];
|
|
3613
|
+
};
|
|
3605
3614
|
/**
|
|
3606
3615
|
* The new (!) message ID to output the assistant response into. This ID
|
|
3607
3616
|
* should be a non-existing message ID, optimistically assigned by the
|
|
@@ -3609,12 +3618,6 @@ type AskAIPair = DefineCmd<"ask-ai", {
|
|
|
3609
3618
|
* message ID.
|
|
3610
3619
|
*/
|
|
3611
3620
|
targetMessageId: MessageId;
|
|
3612
|
-
/**
|
|
3613
|
-
* The Copilot ID to use for this request. If not provided, a built-in
|
|
3614
|
-
* default Copilot will be used instead of one that you configured via the
|
|
3615
|
-
* dashboard.
|
|
3616
|
-
*/
|
|
3617
|
-
copilotId?: CopilotId;
|
|
3618
3621
|
/**
|
|
3619
3622
|
* A client ID unique to this command. Later delta and settle messages will
|
|
3620
3623
|
* reference this client ID, which is important to ensure that tool calls
|
|
@@ -3622,13 +3625,10 @@ type AskAIPair = DefineCmd<"ask-ai", {
|
|
|
3622
3625
|
* that originally made the request that produced the tool call.
|
|
3623
3626
|
*/
|
|
3624
3627
|
clientId: ClientId;
|
|
3625
|
-
|
|
3626
|
-
tools?: AiToolDefinition[];
|
|
3627
|
-
toolChoice?: ToolChoice;
|
|
3628
|
-
context?: AiChatContext[];
|
|
3629
|
-
timeout: number;
|
|
3628
|
+
generationOptions: AiGenerationOptions;
|
|
3630
3629
|
}, {
|
|
3631
|
-
|
|
3630
|
+
sourceMessage?: AiChatMessage;
|
|
3631
|
+
targetMessage: AiChatMessage;
|
|
3632
3632
|
}>;
|
|
3633
3633
|
type AbortAiPair = DefineCmd<"abort-ai", {
|
|
3634
3634
|
messageId: MessageId;
|
|
@@ -3681,8 +3681,7 @@ type SettleServerEvent = {
|
|
|
3681
3681
|
};
|
|
3682
3682
|
type AiChat = {
|
|
3683
3683
|
id: ChatId;
|
|
3684
|
-
|
|
3685
|
-
ephemeral: boolean;
|
|
3684
|
+
title: string;
|
|
3686
3685
|
metadata: Record<string, string | string[]>;
|
|
3687
3686
|
createdAt: ISODateString;
|
|
3688
3687
|
lastMessageAt?: ISODateString;
|
|
@@ -3729,10 +3728,6 @@ type AiUploadedImagePart = {
|
|
|
3729
3728
|
type AiUserContentPart = AiTextPart | AiUploadedImagePart;
|
|
3730
3729
|
type AiAssistantContentPart = AiReasoningPart | AiTextPart | AiToolCallPart;
|
|
3731
3730
|
type AiAssistantDeltaUpdate = AiAssistantContentPart | AiTextDelta | AiReasoningDelta;
|
|
3732
|
-
type ToolChoice = "auto" | "required" | "none" | {
|
|
3733
|
-
type: "tool";
|
|
3734
|
-
toolName: string;
|
|
3735
|
-
};
|
|
3736
3731
|
type AiUserMessage = {
|
|
3737
3732
|
id: MessageId;
|
|
3738
3733
|
chatId: ChatId;
|
|
@@ -3775,9 +3770,9 @@ type AiPendingAssistantMessage = {
|
|
|
3775
3770
|
contentSoFar: AiAssistantContentPart[];
|
|
3776
3771
|
};
|
|
3777
3772
|
type AiChatMessage = AiUserMessage | AiAssistantMessage;
|
|
3778
|
-
type
|
|
3779
|
-
value: string;
|
|
3773
|
+
type AiKnowledgeSource = {
|
|
3780
3774
|
description: string;
|
|
3775
|
+
value: Json;
|
|
3781
3776
|
};
|
|
3782
3777
|
|
|
3783
3778
|
type ClientToolDefinition = {
|
|
@@ -3810,11 +3805,7 @@ type AiContext = {
|
|
|
3810
3805
|
chatsStore: ReturnType<typeof createStore_forUserAiChats>;
|
|
3811
3806
|
toolsStore: ReturnType<typeof createStore_forTools>;
|
|
3812
3807
|
messagesStore: ReturnType<typeof createStore_forChatMessages>;
|
|
3813
|
-
|
|
3814
|
-
};
|
|
3815
|
-
type CreateChatOptions = {
|
|
3816
|
-
ephemeral?: boolean;
|
|
3817
|
-
metadata?: AiChat["metadata"];
|
|
3808
|
+
knowledgeByChatId: Map<string, Set<AiKnowledgeSource>>;
|
|
3818
3809
|
};
|
|
3819
3810
|
type AskAiOptions = {
|
|
3820
3811
|
copilotId?: CopilotId;
|
|
@@ -3852,6 +3843,7 @@ declare function createStore_forUserAiChats(): {
|
|
|
3852
3843
|
upsertMany: (chats: AiChat[]) => void;
|
|
3853
3844
|
remove: (chatId: string) => void;
|
|
3854
3845
|
};
|
|
3846
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3855
3847
|
type Ai = {
|
|
3856
3848
|
[kInternal]: {
|
|
3857
3849
|
debugContext: () => AiContext;
|
|
@@ -3860,29 +3852,42 @@ type Ai = {
|
|
|
3860
3852
|
reconnect: () => void;
|
|
3861
3853
|
disconnect: () => void;
|
|
3862
3854
|
getStatus: () => Status;
|
|
3855
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3863
3856
|
getChats: (options?: {
|
|
3864
3857
|
cursor?: Cursor;
|
|
3865
3858
|
}) => Promise<GetChatsResponse>;
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3859
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3860
|
+
getOrCreateChat: (
|
|
3861
|
+
/** A unique identifier for the chat. */
|
|
3862
|
+
chatId: string,
|
|
3863
|
+
/** A human-friendly title for the chat. If not set, it will get auto-generated after the first response. */
|
|
3864
|
+
title?: string, options?: CreateChatOptions) => Promise<GetOrCreateChatResponse>;
|
|
3865
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3869
3866
|
deleteChat: (chatId: string) => Promise<DeleteChatResponse>;
|
|
3867
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3870
3868
|
getMessageTree: (chatId: string) => Promise<GetMessageTreeResponse>;
|
|
3869
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3871
3870
|
deleteMessage: (chatId: string, messageId: MessageId) => Promise<DeleteMessageResponse>;
|
|
3871
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3872
3872
|
clearChat: (chatId: string) => Promise<ClearChatResponse>;
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
addUserMessageAndAsk: (chatId: string, parentMessageId: MessageId | null, message: string, options?: AskAiOptions) => Promise<
|
|
3873
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3874
|
+
regenerateMessage: (chatId: string, messageId: MessageId, options?: AskAiOptions) => Promise<AskInChatResponse>;
|
|
3875
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3876
|
+
addUserMessageAndAsk: (chatId: string, parentMessageId: MessageId | null, message: string, options?: AskAiOptions) => Promise<AskInChatResponse>;
|
|
3877
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3877
3878
|
abort: (messageId: MessageId) => Promise<AbortAiResponse>;
|
|
3879
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3878
3880
|
signals: {
|
|
3879
3881
|
chatsΣ: DerivedSignal<AiChat[]>;
|
|
3880
3882
|
getChatMessagesForBranchΣ(chatId: string, branch?: MessageId): DerivedSignal<UiChatMessage[]>;
|
|
3881
3883
|
getMessagesForChatΣ(chatId: string): DerivedSignal<AiChatMessage[]>;
|
|
3882
3884
|
getToolDefinitionΣ(chatId: string, toolName: string): Signal<ClientToolDefinition | undefined>;
|
|
3883
3885
|
};
|
|
3884
|
-
|
|
3886
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3887
|
+
registerKnowledgeSource: (chatId: string, data: AiKnowledgeSource) => () => void;
|
|
3888
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3885
3889
|
registerChatTool: (chatId: string, name: string, definition: ClientToolDefinition) => void;
|
|
3890
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3886
3891
|
unregisterChatTool: (chatId: string, toolName: string) => void;
|
|
3887
3892
|
};
|
|
3888
3893
|
|
|
@@ -4674,4 +4679,4 @@ declare const CommentsApiError: typeof HttpError;
|
|
|
4674
4679
|
/** @deprecated Use HttpError instead. */
|
|
4675
4680
|
declare const NotificationsApiError: typeof HttpError;
|
|
4676
4681
|
|
|
4677
|
-
export { type AckOp, type ActivityData, type AiAssistantContentPart, type AiChat, type
|
|
4682
|
+
export { type AckOp, type ActivityData, type AiAssistantContentPart, type AiChat, type AiKnowledgeSource, 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 ClientToolDefinition, 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 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 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, 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
|
@@ -3540,16 +3540,15 @@ type DefineCmd<CmdName extends string, TRequest, TResponse> = [
|
|
|
3540
3540
|
cmdId: CmdId;
|
|
3541
3541
|
} & TResponse>
|
|
3542
3542
|
];
|
|
3543
|
-
type CommandPair = GetChatsPair |
|
|
3543
|
+
type CommandPair = GetChatsPair | GetOrCreateChatPair | DeleteChatPair | GetMessageTreePair | DeleteMessagePair | ClearChatPair | AskInChatPair | AbortAiPair;
|
|
3544
3544
|
type ServerCmdResponse<T extends CommandPair = CommandPair> = T[1];
|
|
3545
3545
|
type GetChatsResponse = ServerCmdResponse<GetChatsPair>;
|
|
3546
|
-
type
|
|
3546
|
+
type GetOrCreateChatResponse = ServerCmdResponse<GetOrCreateChatPair>;
|
|
3547
3547
|
type DeleteChatResponse = ServerCmdResponse<DeleteChatPair>;
|
|
3548
3548
|
type GetMessageTreeResponse = ServerCmdResponse<GetMessageTreePair>;
|
|
3549
|
-
type AddUserMessageResponse = ServerCmdResponse<AddUserMessagePair>;
|
|
3550
3549
|
type DeleteMessageResponse = ServerCmdResponse<DeleteMessagePair>;
|
|
3551
3550
|
type ClearChatResponse = ServerCmdResponse<ClearChatPair>;
|
|
3552
|
-
type
|
|
3551
|
+
type AskInChatResponse = ServerCmdResponse<AskInChatPair>;
|
|
3553
3552
|
type AbortAiResponse = ServerCmdResponse<AbortAiPair>;
|
|
3554
3553
|
type GetChatsPair = DefineCmd<"get-chats", {
|
|
3555
3554
|
cursor?: Cursor;
|
|
@@ -3558,12 +3557,13 @@ type GetChatsPair = DefineCmd<"get-chats", {
|
|
|
3558
3557
|
chats: AiChat[];
|
|
3559
3558
|
nextCursor: Cursor | null;
|
|
3560
3559
|
}>;
|
|
3561
|
-
type
|
|
3562
|
-
|
|
3560
|
+
type CreateChatOptions = {
|
|
3561
|
+
title?: string;
|
|
3562
|
+
metadata?: Record<string, string | string[]>;
|
|
3563
|
+
};
|
|
3564
|
+
type GetOrCreateChatPair = DefineCmd<"get-or-create-chat", {
|
|
3563
3565
|
id: ChatId;
|
|
3564
|
-
|
|
3565
|
-
ephemeral: boolean;
|
|
3566
|
-
metadata: Record<string, string | string[]>;
|
|
3566
|
+
options?: CreateChatOptions;
|
|
3567
3567
|
}, {
|
|
3568
3568
|
chat: AiChat;
|
|
3569
3569
|
}>;
|
|
@@ -3578,14 +3578,6 @@ type GetMessageTreePair = DefineCmd<"get-message-tree", {
|
|
|
3578
3578
|
chat: AiChat;
|
|
3579
3579
|
messages: AiChatMessage[];
|
|
3580
3580
|
}>;
|
|
3581
|
-
type AddUserMessagePair = DefineCmd<"add-user-message", {
|
|
3582
|
-
id: MessageId;
|
|
3583
|
-
chatId: ChatId;
|
|
3584
|
-
parentMessageId: MessageId | null;
|
|
3585
|
-
content: AiUserContentPart[];
|
|
3586
|
-
}, {
|
|
3587
|
-
message: AiUserMessage;
|
|
3588
|
-
}>;
|
|
3589
3581
|
type DeleteMessagePair = DefineCmd<"delete-message", {
|
|
3590
3582
|
chatId: ChatId;
|
|
3591
3583
|
messageId: MessageId;
|
|
@@ -3598,10 +3590,27 @@ type ClearChatPair = DefineCmd<"clear-chat", {
|
|
|
3598
3590
|
}, {
|
|
3599
3591
|
chatId: ChatId;
|
|
3600
3592
|
}>;
|
|
3601
|
-
type
|
|
3593
|
+
type AiGenerationOptions = {
|
|
3594
|
+
/**
|
|
3595
|
+
* The Copilot ID to use for this request. If not provided, a built-in
|
|
3596
|
+
* default Copilot will be used instead of one that you configured via the
|
|
3597
|
+
* dashboard.
|
|
3598
|
+
*/
|
|
3599
|
+
copilotId?: CopilotId;
|
|
3600
|
+
stream: boolean;
|
|
3601
|
+
tools?: AiToolDefinition[];
|
|
3602
|
+
knowledge?: AiKnowledgeSource[];
|
|
3603
|
+
timeout: number;
|
|
3604
|
+
};
|
|
3605
|
+
type AskInChatPair = DefineCmd<"ask-in-chat", {
|
|
3602
3606
|
chatId: ChatId;
|
|
3603
3607
|
/** The chat message to use as the source to create the assistant response. */
|
|
3604
|
-
|
|
3608
|
+
sourceMessage: // An existing message ID to reply to
|
|
3609
|
+
MessageId | {
|
|
3610
|
+
id: MessageId;
|
|
3611
|
+
parentMessageId: MessageId | null;
|
|
3612
|
+
content: AiUserContentPart[];
|
|
3613
|
+
};
|
|
3605
3614
|
/**
|
|
3606
3615
|
* The new (!) message ID to output the assistant response into. This ID
|
|
3607
3616
|
* should be a non-existing message ID, optimistically assigned by the
|
|
@@ -3609,12 +3618,6 @@ type AskAIPair = DefineCmd<"ask-ai", {
|
|
|
3609
3618
|
* message ID.
|
|
3610
3619
|
*/
|
|
3611
3620
|
targetMessageId: MessageId;
|
|
3612
|
-
/**
|
|
3613
|
-
* The Copilot ID to use for this request. If not provided, a built-in
|
|
3614
|
-
* default Copilot will be used instead of one that you configured via the
|
|
3615
|
-
* dashboard.
|
|
3616
|
-
*/
|
|
3617
|
-
copilotId?: CopilotId;
|
|
3618
3621
|
/**
|
|
3619
3622
|
* A client ID unique to this command. Later delta and settle messages will
|
|
3620
3623
|
* reference this client ID, which is important to ensure that tool calls
|
|
@@ -3622,13 +3625,10 @@ type AskAIPair = DefineCmd<"ask-ai", {
|
|
|
3622
3625
|
* that originally made the request that produced the tool call.
|
|
3623
3626
|
*/
|
|
3624
3627
|
clientId: ClientId;
|
|
3625
|
-
|
|
3626
|
-
tools?: AiToolDefinition[];
|
|
3627
|
-
toolChoice?: ToolChoice;
|
|
3628
|
-
context?: AiChatContext[];
|
|
3629
|
-
timeout: number;
|
|
3628
|
+
generationOptions: AiGenerationOptions;
|
|
3630
3629
|
}, {
|
|
3631
|
-
|
|
3630
|
+
sourceMessage?: AiChatMessage;
|
|
3631
|
+
targetMessage: AiChatMessage;
|
|
3632
3632
|
}>;
|
|
3633
3633
|
type AbortAiPair = DefineCmd<"abort-ai", {
|
|
3634
3634
|
messageId: MessageId;
|
|
@@ -3681,8 +3681,7 @@ type SettleServerEvent = {
|
|
|
3681
3681
|
};
|
|
3682
3682
|
type AiChat = {
|
|
3683
3683
|
id: ChatId;
|
|
3684
|
-
|
|
3685
|
-
ephemeral: boolean;
|
|
3684
|
+
title: string;
|
|
3686
3685
|
metadata: Record<string, string | string[]>;
|
|
3687
3686
|
createdAt: ISODateString;
|
|
3688
3687
|
lastMessageAt?: ISODateString;
|
|
@@ -3729,10 +3728,6 @@ type AiUploadedImagePart = {
|
|
|
3729
3728
|
type AiUserContentPart = AiTextPart | AiUploadedImagePart;
|
|
3730
3729
|
type AiAssistantContentPart = AiReasoningPart | AiTextPart | AiToolCallPart;
|
|
3731
3730
|
type AiAssistantDeltaUpdate = AiAssistantContentPart | AiTextDelta | AiReasoningDelta;
|
|
3732
|
-
type ToolChoice = "auto" | "required" | "none" | {
|
|
3733
|
-
type: "tool";
|
|
3734
|
-
toolName: string;
|
|
3735
|
-
};
|
|
3736
3731
|
type AiUserMessage = {
|
|
3737
3732
|
id: MessageId;
|
|
3738
3733
|
chatId: ChatId;
|
|
@@ -3775,9 +3770,9 @@ type AiPendingAssistantMessage = {
|
|
|
3775
3770
|
contentSoFar: AiAssistantContentPart[];
|
|
3776
3771
|
};
|
|
3777
3772
|
type AiChatMessage = AiUserMessage | AiAssistantMessage;
|
|
3778
|
-
type
|
|
3779
|
-
value: string;
|
|
3773
|
+
type AiKnowledgeSource = {
|
|
3780
3774
|
description: string;
|
|
3775
|
+
value: Json;
|
|
3781
3776
|
};
|
|
3782
3777
|
|
|
3783
3778
|
type ClientToolDefinition = {
|
|
@@ -3810,11 +3805,7 @@ type AiContext = {
|
|
|
3810
3805
|
chatsStore: ReturnType<typeof createStore_forUserAiChats>;
|
|
3811
3806
|
toolsStore: ReturnType<typeof createStore_forTools>;
|
|
3812
3807
|
messagesStore: ReturnType<typeof createStore_forChatMessages>;
|
|
3813
|
-
|
|
3814
|
-
};
|
|
3815
|
-
type CreateChatOptions = {
|
|
3816
|
-
ephemeral?: boolean;
|
|
3817
|
-
metadata?: AiChat["metadata"];
|
|
3808
|
+
knowledgeByChatId: Map<string, Set<AiKnowledgeSource>>;
|
|
3818
3809
|
};
|
|
3819
3810
|
type AskAiOptions = {
|
|
3820
3811
|
copilotId?: CopilotId;
|
|
@@ -3852,6 +3843,7 @@ declare function createStore_forUserAiChats(): {
|
|
|
3852
3843
|
upsertMany: (chats: AiChat[]) => void;
|
|
3853
3844
|
remove: (chatId: string) => void;
|
|
3854
3845
|
};
|
|
3846
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3855
3847
|
type Ai = {
|
|
3856
3848
|
[kInternal]: {
|
|
3857
3849
|
debugContext: () => AiContext;
|
|
@@ -3860,29 +3852,42 @@ type Ai = {
|
|
|
3860
3852
|
reconnect: () => void;
|
|
3861
3853
|
disconnect: () => void;
|
|
3862
3854
|
getStatus: () => Status;
|
|
3855
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3863
3856
|
getChats: (options?: {
|
|
3864
3857
|
cursor?: Cursor;
|
|
3865
3858
|
}) => Promise<GetChatsResponse>;
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3859
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3860
|
+
getOrCreateChat: (
|
|
3861
|
+
/** A unique identifier for the chat. */
|
|
3862
|
+
chatId: string,
|
|
3863
|
+
/** A human-friendly title for the chat. If not set, it will get auto-generated after the first response. */
|
|
3864
|
+
title?: string, options?: CreateChatOptions) => Promise<GetOrCreateChatResponse>;
|
|
3865
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3869
3866
|
deleteChat: (chatId: string) => Promise<DeleteChatResponse>;
|
|
3867
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3870
3868
|
getMessageTree: (chatId: string) => Promise<GetMessageTreeResponse>;
|
|
3869
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3871
3870
|
deleteMessage: (chatId: string, messageId: MessageId) => Promise<DeleteMessageResponse>;
|
|
3871
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3872
3872
|
clearChat: (chatId: string) => Promise<ClearChatResponse>;
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
addUserMessageAndAsk: (chatId: string, parentMessageId: MessageId | null, message: string, options?: AskAiOptions) => Promise<
|
|
3873
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3874
|
+
regenerateMessage: (chatId: string, messageId: MessageId, options?: AskAiOptions) => Promise<AskInChatResponse>;
|
|
3875
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3876
|
+
addUserMessageAndAsk: (chatId: string, parentMessageId: MessageId | null, message: string, options?: AskAiOptions) => Promise<AskInChatResponse>;
|
|
3877
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3877
3878
|
abort: (messageId: MessageId) => Promise<AbortAiResponse>;
|
|
3879
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3878
3880
|
signals: {
|
|
3879
3881
|
chatsΣ: DerivedSignal<AiChat[]>;
|
|
3880
3882
|
getChatMessagesForBranchΣ(chatId: string, branch?: MessageId): DerivedSignal<UiChatMessage[]>;
|
|
3881
3883
|
getMessagesForChatΣ(chatId: string): DerivedSignal<AiChatMessage[]>;
|
|
3882
3884
|
getToolDefinitionΣ(chatId: string, toolName: string): Signal<ClientToolDefinition | undefined>;
|
|
3883
3885
|
};
|
|
3884
|
-
|
|
3886
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3887
|
+
registerKnowledgeSource: (chatId: string, data: AiKnowledgeSource) => () => void;
|
|
3888
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3885
3889
|
registerChatTool: (chatId: string, name: string, definition: ClientToolDefinition) => void;
|
|
3890
|
+
/** @private This AI will change, and is not considered stable. DO NOT RELY on it. */
|
|
3886
3891
|
unregisterChatTool: (chatId: string, toolName: string) => void;
|
|
3887
3892
|
};
|
|
3888
3893
|
|
|
@@ -4674,4 +4679,4 @@ declare const CommentsApiError: typeof HttpError;
|
|
|
4674
4679
|
/** @deprecated Use HttpError instead. */
|
|
4675
4680
|
declare const NotificationsApiError: typeof HttpError;
|
|
4676
4681
|
|
|
4677
|
-
export { type AckOp, type ActivityData, type AiAssistantContentPart, type AiChat, type
|
|
4682
|
+
export { type AckOp, type ActivityData, type AiAssistantContentPart, type AiChat, type AiKnowledgeSource, 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 ClientToolDefinition, 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 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 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, 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 };
|