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