@liveblocks/core 2.25.0-aiprivatebeta8 → 2.25.0-aiprivatebeta9
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 +13 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +96 -43
- package/dist/index.d.ts +96 -43
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { JSONSchema7 } from 'json-schema';
|
|
2
2
|
import { ComponentType } from 'react';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -3600,7 +3600,7 @@ type AiGenerationOptions = {
|
|
|
3600
3600
|
*/
|
|
3601
3601
|
copilotId?: CopilotId;
|
|
3602
3602
|
stream?: boolean;
|
|
3603
|
-
tools?:
|
|
3603
|
+
tools?: AiToolDescription[];
|
|
3604
3604
|
knowledge?: AiKnowledgeSource[];
|
|
3605
3605
|
timeout?: number;
|
|
3606
3606
|
};
|
|
@@ -3637,11 +3637,12 @@ type AbortAiPair = DefineCmd<"abort-ai", {
|
|
|
3637
3637
|
}, {
|
|
3638
3638
|
ok: true;
|
|
3639
3639
|
}>;
|
|
3640
|
+
type ToolResultData = Json;
|
|
3640
3641
|
type SetToolResultPair = DefineCmd<"set-tool-result", {
|
|
3641
3642
|
chatId: ChatId;
|
|
3642
3643
|
messageId: MessageId;
|
|
3643
3644
|
toolCallId: string;
|
|
3644
|
-
result:
|
|
3645
|
+
result: ToolResultData;
|
|
3645
3646
|
clientId: ClientId;
|
|
3646
3647
|
generationOptions: AiGenerationOptions;
|
|
3647
3648
|
}, {
|
|
@@ -3702,12 +3703,12 @@ type AiChat = {
|
|
|
3702
3703
|
lastMessageAt?: ISODateString;
|
|
3703
3704
|
deletedAt?: ISODateString;
|
|
3704
3705
|
};
|
|
3705
|
-
type
|
|
3706
|
+
type AiToolDescription = {
|
|
3706
3707
|
name: string;
|
|
3707
3708
|
description?: string;
|
|
3708
|
-
parameters:
|
|
3709
|
+
parameters: JSONSchema7;
|
|
3709
3710
|
};
|
|
3710
|
-
type AiToolInvocationPart = Relax<AiReceivingToolInvocationPart | AiExecutingToolInvocationPart | AiExecutedToolInvocationPart
|
|
3711
|
+
type AiToolInvocationPart<A extends JsonObject = JsonObject, R extends ToolResultData = ToolResultData> = Relax<AiReceivingToolInvocationPart | AiExecutingToolInvocationPart<A> | AiExecutedToolInvocationPart<A, R>>;
|
|
3711
3712
|
type AiReceivingToolInvocationPart = {
|
|
3712
3713
|
type: "tool-invocation";
|
|
3713
3714
|
status: "receiving";
|
|
@@ -3715,20 +3716,20 @@ type AiReceivingToolInvocationPart = {
|
|
|
3715
3716
|
toolName: string;
|
|
3716
3717
|
partialArgs: Json;
|
|
3717
3718
|
};
|
|
3718
|
-
type AiExecutingToolInvocationPart = {
|
|
3719
|
+
type AiExecutingToolInvocationPart<A extends JsonObject = JsonObject> = {
|
|
3719
3720
|
type: "tool-invocation";
|
|
3720
3721
|
status: "executing";
|
|
3721
3722
|
toolCallId: string;
|
|
3722
3723
|
toolName: string;
|
|
3723
|
-
args:
|
|
3724
|
+
args: A;
|
|
3724
3725
|
};
|
|
3725
|
-
type AiExecutedToolInvocationPart = {
|
|
3726
|
+
type AiExecutedToolInvocationPart<A extends JsonObject = JsonObject, R extends ToolResultData = ToolResultData> = {
|
|
3726
3727
|
type: "tool-invocation";
|
|
3727
3728
|
status: "executed";
|
|
3728
3729
|
toolCallId: string;
|
|
3729
3730
|
toolName: string;
|
|
3730
|
-
args:
|
|
3731
|
-
result:
|
|
3731
|
+
args: A;
|
|
3732
|
+
result: R;
|
|
3732
3733
|
};
|
|
3733
3734
|
type AiTextPart = {
|
|
3734
3735
|
type: "text";
|
|
@@ -3816,15 +3817,66 @@ type AiKnowledgeSource = {
|
|
|
3816
3817
|
value: Json;
|
|
3817
3818
|
};
|
|
3818
3819
|
|
|
3819
|
-
type
|
|
3820
|
-
|
|
3820
|
+
type InferFromSchema<T extends JSONSchema7> = JSONSchema7 extends T ? JsonObject : T extends {
|
|
3821
|
+
type: "object";
|
|
3822
|
+
properties: Record<string, JSONSchema7>;
|
|
3823
|
+
required: readonly string[];
|
|
3824
|
+
} ? Resolve<{
|
|
3825
|
+
-readonly [K in keyof T["properties"] as K extends string ? K extends Extract<K, T["required"][number]> ? K : never : never]: InferFromSchema<T["properties"][K]>;
|
|
3826
|
+
} & {
|
|
3827
|
+
-readonly [K in keyof T["properties"] as K extends string ? K extends Extract<K, T["required"][number]> ? never : K : never]?: InferFromSchema<T["properties"][K]>;
|
|
3828
|
+
}> : T extends {
|
|
3829
|
+
type: "object";
|
|
3830
|
+
properties: Record<string, JSONSchema7>;
|
|
3831
|
+
} ? {
|
|
3832
|
+
-readonly [K in keyof T["properties"]]?: InferFromSchema<T["properties"][K]>;
|
|
3833
|
+
} : T extends {
|
|
3834
|
+
type: "string";
|
|
3835
|
+
} ? string : T extends {
|
|
3836
|
+
type: "number";
|
|
3837
|
+
} ? number : T extends {
|
|
3838
|
+
type: "boolean";
|
|
3839
|
+
} ? boolean : T extends {
|
|
3840
|
+
type: "null";
|
|
3841
|
+
} ? null : T extends {
|
|
3842
|
+
type: "array";
|
|
3843
|
+
items: JSONSchema7;
|
|
3844
|
+
} ? InferFromSchema<T["items"]>[] : unknown;
|
|
3845
|
+
type AiToolTypePack<A extends JsonObject = JsonObject, R extends ToolResultData = ToolResultData> = {
|
|
3846
|
+
A: A;
|
|
3847
|
+
R: R;
|
|
3848
|
+
};
|
|
3849
|
+
type AiToolInvocationProps<A extends JsonObject, R extends ToolResultData> = Resolve<DistributiveOmit<AiToolInvocationPart<A, R>, "type"> & {
|
|
3850
|
+
respond: (result: R) => void;
|
|
3851
|
+
/**
|
|
3852
|
+
* Exposes specific inferred types as a "type pack" which we can pass
|
|
3853
|
+
* around statically to components to "bind" them to specific inferred
|
|
3854
|
+
* A and R values. There is no runtime presence for these.
|
|
3855
|
+
*/
|
|
3856
|
+
$types: AiToolTypePack<A, R>;
|
|
3857
|
+
[kInternal]: {
|
|
3858
|
+
execute: AiToolExecuteCallback<A, R> | undefined;
|
|
3859
|
+
};
|
|
3821
3860
|
}>;
|
|
3822
|
-
type
|
|
3861
|
+
type AiOpaqueToolInvocationProps = AiToolInvocationProps<JsonObject, ToolResultData>;
|
|
3862
|
+
type AiToolExecuteContext = {
|
|
3863
|
+
toolName: string;
|
|
3864
|
+
toolCallId: string;
|
|
3865
|
+
};
|
|
3866
|
+
type AiToolExecuteCallback<A extends JsonObject, R extends ToolResultData> = (args: A, context: AiToolExecuteContext) => Awaitable<R>;
|
|
3867
|
+
type AiToolDefinition<S extends JSONSchema7, A extends JsonObject, R extends ToolResultData> = {
|
|
3823
3868
|
description?: string;
|
|
3824
|
-
parameters:
|
|
3825
|
-
execute?:
|
|
3826
|
-
render?: ComponentType<
|
|
3869
|
+
parameters: S;
|
|
3870
|
+
execute?: AiToolExecuteCallback<A, R>;
|
|
3871
|
+
render?: ComponentType<AiToolInvocationProps<A, R>>;
|
|
3827
3872
|
};
|
|
3873
|
+
type AiOpaqueToolDefinition = AiToolDefinition<JSONSchema7, JsonObject, ToolResultData>;
|
|
3874
|
+
/**
|
|
3875
|
+
* Helper function to help infer the types of `args`, `render`, and `result`.
|
|
3876
|
+
* This function has no runtime implementation and is only needed to make it
|
|
3877
|
+
* possible for TypeScript to infer types.
|
|
3878
|
+
*/
|
|
3879
|
+
declare function defineAiTool<R extends ToolResultData>(): <const S extends JSONSchema7>(def: AiToolDefinition<S, InferFromSchema<S> extends JsonObject ? InferFromSchema<S> : JsonObject, R>) => AiOpaqueToolDefinition;
|
|
3828
3880
|
type UiChatMessage = AiChatMessage & {
|
|
3829
3881
|
navigation: {
|
|
3830
3882
|
/**
|
|
@@ -3896,15 +3948,15 @@ declare class KnowledgeStack {
|
|
|
3896
3948
|
updateKnowledge(layerKey: LayerKey, key: string, data: AiKnowledgeSource | null): void;
|
|
3897
3949
|
}
|
|
3898
3950
|
declare function createStore_forTools(): {
|
|
3899
|
-
getToolDefinitionΣ: (chatId: string, toolName: string) => Signal<
|
|
3951
|
+
getToolDefinitionΣ: (chatId: string, toolName: string) => Signal<AiOpaqueToolDefinition | undefined>;
|
|
3900
3952
|
getToolsForChat: (chatId: string) => {
|
|
3901
3953
|
name: string;
|
|
3902
|
-
definition:
|
|
3954
|
+
definition: AiOpaqueToolDefinition;
|
|
3903
3955
|
}[];
|
|
3904
|
-
addToolDefinition: (chatId: string, name: string, definition:
|
|
3956
|
+
addToolDefinition: (chatId: string, name: string, definition: AiOpaqueToolDefinition) => void;
|
|
3905
3957
|
removeToolDefinition: (chatId: string, toolName: string) => void;
|
|
3906
3958
|
};
|
|
3907
|
-
declare function createStore_forChatMessages(toolsStore: ReturnType<typeof createStore_forTools>, setToolResult: (chatId: string, messageId: MessageId, toolCallId: string, result:
|
|
3959
|
+
declare function createStore_forChatMessages(toolsStore: ReturnType<typeof createStore_forTools>, setToolResult: (chatId: string, messageId: MessageId, toolCallId: string, result: ToolResultData, options?: AiGenerationOptions) => Promise<AskInChatResponse>): {
|
|
3908
3960
|
getMessageById: (messageId: MessageId) => AiChatMessage | undefined;
|
|
3909
3961
|
getChatMessagesForBranchΣ: (chatId: string, branch?: MessageId) => DerivedSignal<UiChatMessage[]>;
|
|
3910
3962
|
createOptimistically: {
|
|
@@ -3925,7 +3977,7 @@ declare function createStore_forUserAiChats(): {
|
|
|
3925
3977
|
upsertMany: (chats: AiChat[]) => void;
|
|
3926
3978
|
remove: (chatId: string) => void;
|
|
3927
3979
|
};
|
|
3928
|
-
/** @private This
|
|
3980
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3929
3981
|
type Ai = {
|
|
3930
3982
|
[kInternal]: {
|
|
3931
3983
|
context: AiContext;
|
|
@@ -3934,50 +3986,51 @@ type Ai = {
|
|
|
3934
3986
|
reconnect: () => void;
|
|
3935
3987
|
disconnect: () => void;
|
|
3936
3988
|
getStatus: () => Status;
|
|
3937
|
-
/** @private This
|
|
3989
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3938
3990
|
getChats: (options?: {
|
|
3939
3991
|
cursor?: Cursor;
|
|
3940
3992
|
}) => Promise<GetChatsResponse>;
|
|
3941
|
-
/** @private This
|
|
3993
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3942
3994
|
getOrCreateChat: (
|
|
3943
3995
|
/** A unique identifier for the chat. */
|
|
3944
3996
|
chatId: string, options?: CreateChatOptions) => Promise<GetOrCreateChatResponse>;
|
|
3945
|
-
/** @private This
|
|
3997
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3946
3998
|
deleteChat: (chatId: string) => Promise<DeleteChatResponse>;
|
|
3947
|
-
/** @private This
|
|
3999
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3948
4000
|
getMessageTree: (chatId: string) => Promise<GetMessageTreeResponse>;
|
|
3949
|
-
/** @private This
|
|
4001
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3950
4002
|
deleteMessage: (chatId: string, messageId: MessageId) => Promise<DeleteMessageResponse>;
|
|
3951
|
-
/** @private This
|
|
4003
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3952
4004
|
clearChat: (chatId: string) => Promise<ClearChatResponse>;
|
|
3953
|
-
/** @private This
|
|
4005
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3954
4006
|
askUserMessageInChat: (chatId: string, userMessage: MessageId | {
|
|
3955
4007
|
id: MessageId;
|
|
3956
4008
|
parentMessageId: MessageId | null;
|
|
3957
4009
|
content: AiUserContentPart[];
|
|
3958
4010
|
}, targetMessageId: MessageId, options?: AiGenerationOptions) => Promise<AskInChatResponse>;
|
|
3959
|
-
/** @private This
|
|
4011
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3960
4012
|
abort: (messageId: MessageId) => Promise<AbortAiResponse>;
|
|
3961
|
-
/** @private This
|
|
3962
|
-
setToolResult: (chatId: string, messageId: MessageId, toolCallId: string, result:
|
|
3963
|
-
/** @private This
|
|
4013
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
4014
|
+
setToolResult: (chatId: string, messageId: MessageId, toolCallId: string, result: ToolResultData, options?: AiGenerationOptions) => Promise<AskInChatResponse>;
|
|
4015
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3964
4016
|
signals: {
|
|
3965
4017
|
chatsΣ: DerivedSignal<AiChat[]>;
|
|
3966
4018
|
getChatMessagesForBranchΣ(chatId: string, branch?: MessageId): DerivedSignal<UiChatMessage[]>;
|
|
3967
|
-
|
|
3968
|
-
getToolDefinitionΣ(chatId: string, toolName: string): Signal<AiToolDefinition | undefined>;
|
|
4019
|
+
getToolDefinitionΣ(chatId: string, toolName: string): Signal<AiOpaqueToolDefinition | undefined>;
|
|
3969
4020
|
};
|
|
3970
|
-
/** @private This
|
|
4021
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
4022
|
+
getChatById: (chatId: string) => AiChat | undefined;
|
|
4023
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3971
4024
|
registerKnowledgeLayer: (uniqueLayerId: string) => LayerKey;
|
|
3972
|
-
/** @private This
|
|
4025
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3973
4026
|
deregisterKnowledgeLayer: (layerKey: LayerKey) => void;
|
|
3974
|
-
/** @private This
|
|
4027
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3975
4028
|
updateKnowledge: (layerKey: LayerKey, data: AiKnowledgeSource, key?: string) => void;
|
|
3976
|
-
/** @private This
|
|
4029
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3977
4030
|
debug_getAllKnowledge(): AiKnowledgeSource[];
|
|
3978
|
-
/** @private This
|
|
3979
|
-
registerChatTool: (chatId: string, name: string, definition:
|
|
3980
|
-
/** @private This
|
|
4031
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
4032
|
+
registerChatTool: (chatId: string, name: string, definition: AiOpaqueToolDefinition) => void;
|
|
4033
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3981
4034
|
unregisterChatTool: (chatId: string, toolName: string) => void;
|
|
3982
4035
|
};
|
|
3983
4036
|
|
|
@@ -4769,4 +4822,4 @@ declare const CommentsApiError: typeof HttpError;
|
|
|
4769
4822
|
/** @deprecated Use HttpError instead. */
|
|
4770
4823
|
declare const NotificationsApiError: typeof HttpError;
|
|
4771
4824
|
|
|
4772
|
-
export { type AckOp, type ActivityData, type AiAssistantContentPart, type AiChat, type AiKnowledgeSource, type AiToolDefinition, type
|
|
4825
|
+
export { type AckOp, type ActivityData, type AiAssistantContentPart, type AiChat, type AiChatMessage, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, CommentsApiError, type CommentsEventServerMsg, type ContextualPromptContext, type ContextualPromptResponse, type CopilotId, CrdtType, type CreateListOp, type CreateManagedPoolOptions, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type Cursor, type CustomAuthenticationResult, type DAD, type DE, type DM, type DP, type DRI, type DS, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, Deque, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, HttpError, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InferFromSchema, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, type LargeMessageStrategy, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, type ManagedPool, type MessageId, MutableSignal, type NoInfr, type NodeMap, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialNotificationSettings, type PartialUnless, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RejectedStorageOpServerMsg, type Relax, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, type RoomStateServerMsg, type RoomSubscriptionSettings, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SubscriptionData, type SubscriptionDataPlain, type SubscriptionDeleteInfo, type SubscriptionDeleteInfoPlain, type SubscriptionKey, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type ToolResultData, type URLSafeString, type UiAssistantMessage, type UiChatMessage, type UiUserMessage, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type User, type UserJoinServerMsg, type UserLeftServerMsg, type UserNotificationSettings, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, checkBounds, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToSubscriptionData, convertToThreadData, convertToUserSubscriptionData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createManagedPool, createNotificationSettings, createThreadId, defineAiTool, deprecate, deprecateIf, detectDupes, entries, errorIf, freeze, generateCommentUrl, getMentionedIdsFromCommentBody, getSubscriptionKey, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isPlainObject, isRootCrdt, isStartsWithOperator, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, patchNotificationSettings, raise, resolveUsersInCommentBody, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toAbsoluteUrl, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { JSONSchema7 } from 'json-schema';
|
|
2
2
|
import { ComponentType } from 'react';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -3600,7 +3600,7 @@ type AiGenerationOptions = {
|
|
|
3600
3600
|
*/
|
|
3601
3601
|
copilotId?: CopilotId;
|
|
3602
3602
|
stream?: boolean;
|
|
3603
|
-
tools?:
|
|
3603
|
+
tools?: AiToolDescription[];
|
|
3604
3604
|
knowledge?: AiKnowledgeSource[];
|
|
3605
3605
|
timeout?: number;
|
|
3606
3606
|
};
|
|
@@ -3637,11 +3637,12 @@ type AbortAiPair = DefineCmd<"abort-ai", {
|
|
|
3637
3637
|
}, {
|
|
3638
3638
|
ok: true;
|
|
3639
3639
|
}>;
|
|
3640
|
+
type ToolResultData = Json;
|
|
3640
3641
|
type SetToolResultPair = DefineCmd<"set-tool-result", {
|
|
3641
3642
|
chatId: ChatId;
|
|
3642
3643
|
messageId: MessageId;
|
|
3643
3644
|
toolCallId: string;
|
|
3644
|
-
result:
|
|
3645
|
+
result: ToolResultData;
|
|
3645
3646
|
clientId: ClientId;
|
|
3646
3647
|
generationOptions: AiGenerationOptions;
|
|
3647
3648
|
}, {
|
|
@@ -3702,12 +3703,12 @@ type AiChat = {
|
|
|
3702
3703
|
lastMessageAt?: ISODateString;
|
|
3703
3704
|
deletedAt?: ISODateString;
|
|
3704
3705
|
};
|
|
3705
|
-
type
|
|
3706
|
+
type AiToolDescription = {
|
|
3706
3707
|
name: string;
|
|
3707
3708
|
description?: string;
|
|
3708
|
-
parameters:
|
|
3709
|
+
parameters: JSONSchema7;
|
|
3709
3710
|
};
|
|
3710
|
-
type AiToolInvocationPart = Relax<AiReceivingToolInvocationPart | AiExecutingToolInvocationPart | AiExecutedToolInvocationPart
|
|
3711
|
+
type AiToolInvocationPart<A extends JsonObject = JsonObject, R extends ToolResultData = ToolResultData> = Relax<AiReceivingToolInvocationPart | AiExecutingToolInvocationPart<A> | AiExecutedToolInvocationPart<A, R>>;
|
|
3711
3712
|
type AiReceivingToolInvocationPart = {
|
|
3712
3713
|
type: "tool-invocation";
|
|
3713
3714
|
status: "receiving";
|
|
@@ -3715,20 +3716,20 @@ type AiReceivingToolInvocationPart = {
|
|
|
3715
3716
|
toolName: string;
|
|
3716
3717
|
partialArgs: Json;
|
|
3717
3718
|
};
|
|
3718
|
-
type AiExecutingToolInvocationPart = {
|
|
3719
|
+
type AiExecutingToolInvocationPart<A extends JsonObject = JsonObject> = {
|
|
3719
3720
|
type: "tool-invocation";
|
|
3720
3721
|
status: "executing";
|
|
3721
3722
|
toolCallId: string;
|
|
3722
3723
|
toolName: string;
|
|
3723
|
-
args:
|
|
3724
|
+
args: A;
|
|
3724
3725
|
};
|
|
3725
|
-
type AiExecutedToolInvocationPart = {
|
|
3726
|
+
type AiExecutedToolInvocationPart<A extends JsonObject = JsonObject, R extends ToolResultData = ToolResultData> = {
|
|
3726
3727
|
type: "tool-invocation";
|
|
3727
3728
|
status: "executed";
|
|
3728
3729
|
toolCallId: string;
|
|
3729
3730
|
toolName: string;
|
|
3730
|
-
args:
|
|
3731
|
-
result:
|
|
3731
|
+
args: A;
|
|
3732
|
+
result: R;
|
|
3732
3733
|
};
|
|
3733
3734
|
type AiTextPart = {
|
|
3734
3735
|
type: "text";
|
|
@@ -3816,15 +3817,66 @@ type AiKnowledgeSource = {
|
|
|
3816
3817
|
value: Json;
|
|
3817
3818
|
};
|
|
3818
3819
|
|
|
3819
|
-
type
|
|
3820
|
-
|
|
3820
|
+
type InferFromSchema<T extends JSONSchema7> = JSONSchema7 extends T ? JsonObject : T extends {
|
|
3821
|
+
type: "object";
|
|
3822
|
+
properties: Record<string, JSONSchema7>;
|
|
3823
|
+
required: readonly string[];
|
|
3824
|
+
} ? Resolve<{
|
|
3825
|
+
-readonly [K in keyof T["properties"] as K extends string ? K extends Extract<K, T["required"][number]> ? K : never : never]: InferFromSchema<T["properties"][K]>;
|
|
3826
|
+
} & {
|
|
3827
|
+
-readonly [K in keyof T["properties"] as K extends string ? K extends Extract<K, T["required"][number]> ? never : K : never]?: InferFromSchema<T["properties"][K]>;
|
|
3828
|
+
}> : T extends {
|
|
3829
|
+
type: "object";
|
|
3830
|
+
properties: Record<string, JSONSchema7>;
|
|
3831
|
+
} ? {
|
|
3832
|
+
-readonly [K in keyof T["properties"]]?: InferFromSchema<T["properties"][K]>;
|
|
3833
|
+
} : T extends {
|
|
3834
|
+
type: "string";
|
|
3835
|
+
} ? string : T extends {
|
|
3836
|
+
type: "number";
|
|
3837
|
+
} ? number : T extends {
|
|
3838
|
+
type: "boolean";
|
|
3839
|
+
} ? boolean : T extends {
|
|
3840
|
+
type: "null";
|
|
3841
|
+
} ? null : T extends {
|
|
3842
|
+
type: "array";
|
|
3843
|
+
items: JSONSchema7;
|
|
3844
|
+
} ? InferFromSchema<T["items"]>[] : unknown;
|
|
3845
|
+
type AiToolTypePack<A extends JsonObject = JsonObject, R extends ToolResultData = ToolResultData> = {
|
|
3846
|
+
A: A;
|
|
3847
|
+
R: R;
|
|
3848
|
+
};
|
|
3849
|
+
type AiToolInvocationProps<A extends JsonObject, R extends ToolResultData> = Resolve<DistributiveOmit<AiToolInvocationPart<A, R>, "type"> & {
|
|
3850
|
+
respond: (result: R) => void;
|
|
3851
|
+
/**
|
|
3852
|
+
* Exposes specific inferred types as a "type pack" which we can pass
|
|
3853
|
+
* around statically to components to "bind" them to specific inferred
|
|
3854
|
+
* A and R values. There is no runtime presence for these.
|
|
3855
|
+
*/
|
|
3856
|
+
$types: AiToolTypePack<A, R>;
|
|
3857
|
+
[kInternal]: {
|
|
3858
|
+
execute: AiToolExecuteCallback<A, R> | undefined;
|
|
3859
|
+
};
|
|
3821
3860
|
}>;
|
|
3822
|
-
type
|
|
3861
|
+
type AiOpaqueToolInvocationProps = AiToolInvocationProps<JsonObject, ToolResultData>;
|
|
3862
|
+
type AiToolExecuteContext = {
|
|
3863
|
+
toolName: string;
|
|
3864
|
+
toolCallId: string;
|
|
3865
|
+
};
|
|
3866
|
+
type AiToolExecuteCallback<A extends JsonObject, R extends ToolResultData> = (args: A, context: AiToolExecuteContext) => Awaitable<R>;
|
|
3867
|
+
type AiToolDefinition<S extends JSONSchema7, A extends JsonObject, R extends ToolResultData> = {
|
|
3823
3868
|
description?: string;
|
|
3824
|
-
parameters:
|
|
3825
|
-
execute?:
|
|
3826
|
-
render?: ComponentType<
|
|
3869
|
+
parameters: S;
|
|
3870
|
+
execute?: AiToolExecuteCallback<A, R>;
|
|
3871
|
+
render?: ComponentType<AiToolInvocationProps<A, R>>;
|
|
3827
3872
|
};
|
|
3873
|
+
type AiOpaqueToolDefinition = AiToolDefinition<JSONSchema7, JsonObject, ToolResultData>;
|
|
3874
|
+
/**
|
|
3875
|
+
* Helper function to help infer the types of `args`, `render`, and `result`.
|
|
3876
|
+
* This function has no runtime implementation and is only needed to make it
|
|
3877
|
+
* possible for TypeScript to infer types.
|
|
3878
|
+
*/
|
|
3879
|
+
declare function defineAiTool<R extends ToolResultData>(): <const S extends JSONSchema7>(def: AiToolDefinition<S, InferFromSchema<S> extends JsonObject ? InferFromSchema<S> : JsonObject, R>) => AiOpaqueToolDefinition;
|
|
3828
3880
|
type UiChatMessage = AiChatMessage & {
|
|
3829
3881
|
navigation: {
|
|
3830
3882
|
/**
|
|
@@ -3896,15 +3948,15 @@ declare class KnowledgeStack {
|
|
|
3896
3948
|
updateKnowledge(layerKey: LayerKey, key: string, data: AiKnowledgeSource | null): void;
|
|
3897
3949
|
}
|
|
3898
3950
|
declare function createStore_forTools(): {
|
|
3899
|
-
getToolDefinitionΣ: (chatId: string, toolName: string) => Signal<
|
|
3951
|
+
getToolDefinitionΣ: (chatId: string, toolName: string) => Signal<AiOpaqueToolDefinition | undefined>;
|
|
3900
3952
|
getToolsForChat: (chatId: string) => {
|
|
3901
3953
|
name: string;
|
|
3902
|
-
definition:
|
|
3954
|
+
definition: AiOpaqueToolDefinition;
|
|
3903
3955
|
}[];
|
|
3904
|
-
addToolDefinition: (chatId: string, name: string, definition:
|
|
3956
|
+
addToolDefinition: (chatId: string, name: string, definition: AiOpaqueToolDefinition) => void;
|
|
3905
3957
|
removeToolDefinition: (chatId: string, toolName: string) => void;
|
|
3906
3958
|
};
|
|
3907
|
-
declare function createStore_forChatMessages(toolsStore: ReturnType<typeof createStore_forTools>, setToolResult: (chatId: string, messageId: MessageId, toolCallId: string, result:
|
|
3959
|
+
declare function createStore_forChatMessages(toolsStore: ReturnType<typeof createStore_forTools>, setToolResult: (chatId: string, messageId: MessageId, toolCallId: string, result: ToolResultData, options?: AiGenerationOptions) => Promise<AskInChatResponse>): {
|
|
3908
3960
|
getMessageById: (messageId: MessageId) => AiChatMessage | undefined;
|
|
3909
3961
|
getChatMessagesForBranchΣ: (chatId: string, branch?: MessageId) => DerivedSignal<UiChatMessage[]>;
|
|
3910
3962
|
createOptimistically: {
|
|
@@ -3925,7 +3977,7 @@ declare function createStore_forUserAiChats(): {
|
|
|
3925
3977
|
upsertMany: (chats: AiChat[]) => void;
|
|
3926
3978
|
remove: (chatId: string) => void;
|
|
3927
3979
|
};
|
|
3928
|
-
/** @private This
|
|
3980
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3929
3981
|
type Ai = {
|
|
3930
3982
|
[kInternal]: {
|
|
3931
3983
|
context: AiContext;
|
|
@@ -3934,50 +3986,51 @@ type Ai = {
|
|
|
3934
3986
|
reconnect: () => void;
|
|
3935
3987
|
disconnect: () => void;
|
|
3936
3988
|
getStatus: () => Status;
|
|
3937
|
-
/** @private This
|
|
3989
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3938
3990
|
getChats: (options?: {
|
|
3939
3991
|
cursor?: Cursor;
|
|
3940
3992
|
}) => Promise<GetChatsResponse>;
|
|
3941
|
-
/** @private This
|
|
3993
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3942
3994
|
getOrCreateChat: (
|
|
3943
3995
|
/** A unique identifier for the chat. */
|
|
3944
3996
|
chatId: string, options?: CreateChatOptions) => Promise<GetOrCreateChatResponse>;
|
|
3945
|
-
/** @private This
|
|
3997
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3946
3998
|
deleteChat: (chatId: string) => Promise<DeleteChatResponse>;
|
|
3947
|
-
/** @private This
|
|
3999
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3948
4000
|
getMessageTree: (chatId: string) => Promise<GetMessageTreeResponse>;
|
|
3949
|
-
/** @private This
|
|
4001
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3950
4002
|
deleteMessage: (chatId: string, messageId: MessageId) => Promise<DeleteMessageResponse>;
|
|
3951
|
-
/** @private This
|
|
4003
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3952
4004
|
clearChat: (chatId: string) => Promise<ClearChatResponse>;
|
|
3953
|
-
/** @private This
|
|
4005
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3954
4006
|
askUserMessageInChat: (chatId: string, userMessage: MessageId | {
|
|
3955
4007
|
id: MessageId;
|
|
3956
4008
|
parentMessageId: MessageId | null;
|
|
3957
4009
|
content: AiUserContentPart[];
|
|
3958
4010
|
}, targetMessageId: MessageId, options?: AiGenerationOptions) => Promise<AskInChatResponse>;
|
|
3959
|
-
/** @private This
|
|
4011
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3960
4012
|
abort: (messageId: MessageId) => Promise<AbortAiResponse>;
|
|
3961
|
-
/** @private This
|
|
3962
|
-
setToolResult: (chatId: string, messageId: MessageId, toolCallId: string, result:
|
|
3963
|
-
/** @private This
|
|
4013
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
4014
|
+
setToolResult: (chatId: string, messageId: MessageId, toolCallId: string, result: ToolResultData, options?: AiGenerationOptions) => Promise<AskInChatResponse>;
|
|
4015
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3964
4016
|
signals: {
|
|
3965
4017
|
chatsΣ: DerivedSignal<AiChat[]>;
|
|
3966
4018
|
getChatMessagesForBranchΣ(chatId: string, branch?: MessageId): DerivedSignal<UiChatMessage[]>;
|
|
3967
|
-
|
|
3968
|
-
getToolDefinitionΣ(chatId: string, toolName: string): Signal<AiToolDefinition | undefined>;
|
|
4019
|
+
getToolDefinitionΣ(chatId: string, toolName: string): Signal<AiOpaqueToolDefinition | undefined>;
|
|
3969
4020
|
};
|
|
3970
|
-
/** @private This
|
|
4021
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
4022
|
+
getChatById: (chatId: string) => AiChat | undefined;
|
|
4023
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3971
4024
|
registerKnowledgeLayer: (uniqueLayerId: string) => LayerKey;
|
|
3972
|
-
/** @private This
|
|
4025
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3973
4026
|
deregisterKnowledgeLayer: (layerKey: LayerKey) => void;
|
|
3974
|
-
/** @private This
|
|
4027
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3975
4028
|
updateKnowledge: (layerKey: LayerKey, data: AiKnowledgeSource, key?: string) => void;
|
|
3976
|
-
/** @private This
|
|
4029
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3977
4030
|
debug_getAllKnowledge(): AiKnowledgeSource[];
|
|
3978
|
-
/** @private This
|
|
3979
|
-
registerChatTool: (chatId: string, name: string, definition:
|
|
3980
|
-
/** @private This
|
|
4031
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
4032
|
+
registerChatTool: (chatId: string, name: string, definition: AiOpaqueToolDefinition) => void;
|
|
4033
|
+
/** @private This API will change, and is not considered stable. DO NOT RELY on it. */
|
|
3981
4034
|
unregisterChatTool: (chatId: string, toolName: string) => void;
|
|
3982
4035
|
};
|
|
3983
4036
|
|
|
@@ -4769,4 +4822,4 @@ declare const CommentsApiError: typeof HttpError;
|
|
|
4769
4822
|
/** @deprecated Use HttpError instead. */
|
|
4770
4823
|
declare const NotificationsApiError: typeof HttpError;
|
|
4771
4824
|
|
|
4772
|
-
export { type AckOp, type ActivityData, type AiAssistantContentPart, type AiChat, type AiKnowledgeSource, type AiToolDefinition, type
|
|
4825
|
+
export { type AckOp, type ActivityData, type AiAssistantContentPart, type AiChat, type AiChatMessage, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, CommentsApiError, type CommentsEventServerMsg, type ContextualPromptContext, type ContextualPromptResponse, type CopilotId, CrdtType, type CreateListOp, type CreateManagedPoolOptions, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type Cursor, type CustomAuthenticationResult, type DAD, type DE, type DM, type DP, type DRI, type DS, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, Deque, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, HttpError, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InferFromSchema, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, type LargeMessageStrategy, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, type ManagedPool, type MessageId, MutableSignal, type NoInfr, type NodeMap, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialNotificationSettings, type PartialUnless, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RejectedStorageOpServerMsg, type Relax, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, type RoomStateServerMsg, type RoomSubscriptionSettings, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SubscriptionData, type SubscriptionDataPlain, type SubscriptionDeleteInfo, type SubscriptionDeleteInfoPlain, type SubscriptionKey, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type ToolResultData, type URLSafeString, type UiAssistantMessage, type UiChatMessage, type UiUserMessage, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type User, type UserJoinServerMsg, type UserLeftServerMsg, type UserNotificationSettings, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, checkBounds, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToSubscriptionData, convertToThreadData, convertToUserSubscriptionData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createManagedPool, createNotificationSettings, createThreadId, defineAiTool, deprecate, deprecateIf, detectDupes, entries, errorIf, freeze, generateCommentUrl, getMentionedIdsFromCommentBody, getSubscriptionKey, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isPlainObject, isRootCrdt, isStartsWithOperator, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, patchNotificationSettings, raise, resolveUsersInCommentBody, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toAbsoluteUrl, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var __export = (target, all) => {
|
|
|
6
6
|
|
|
7
7
|
// src/version.ts
|
|
8
8
|
var PKG_NAME = "@liveblocks/core";
|
|
9
|
-
var PKG_VERSION = "2.25.0-
|
|
9
|
+
var PKG_VERSION = "2.25.0-aiprivatebeta9";
|
|
10
10
|
var PKG_FORMAT = "esm";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -3715,6 +3715,11 @@ function appendDelta(content, delta) {
|
|
|
3715
3715
|
|
|
3716
3716
|
// src/ai.ts
|
|
3717
3717
|
var DEFAULT_REQUEST_TIMEOUT = 4e3;
|
|
3718
|
+
function defineAiTool() {
|
|
3719
|
+
return (def) => {
|
|
3720
|
+
return def;
|
|
3721
|
+
};
|
|
3722
|
+
}
|
|
3718
3723
|
var KnowledgeStack = class {
|
|
3719
3724
|
#_layers;
|
|
3720
3725
|
#stack;
|
|
@@ -3920,7 +3925,10 @@ function createStore_forChatMessages(toolsStore, setToolResult) {
|
|
|
3920
3925
|
const executeFn = toolDef?.execute;
|
|
3921
3926
|
if (executeFn) {
|
|
3922
3927
|
(async () => {
|
|
3923
|
-
const result = await executeFn(toolCall.args
|
|
3928
|
+
const result = await executeFn(toolCall.args, {
|
|
3929
|
+
toolName: toolCall.toolName,
|
|
3930
|
+
toolCallId: toolCall.toolCallId
|
|
3931
|
+
});
|
|
3924
3932
|
respondSync(result);
|
|
3925
3933
|
})().catch((err) => {
|
|
3926
3934
|
error2(
|
|
@@ -4402,9 +4410,9 @@ function createAi(config) {
|
|
|
4402
4410
|
signals: {
|
|
4403
4411
|
chats\u03A3: context.chatsStore.chats\u03A3,
|
|
4404
4412
|
getChatMessagesForBranch\u03A3: context.messagesStore.getChatMessagesForBranch\u03A3,
|
|
4405
|
-
getChatById: context.chatsStore.getChatById,
|
|
4406
4413
|
getToolDefinition\u03A3: context.toolsStore.getToolDefinition\u03A3
|
|
4407
4414
|
},
|
|
4415
|
+
getChatById: context.chatsStore.getChatById,
|
|
4408
4416
|
registerKnowledgeLayer,
|
|
4409
4417
|
deregisterKnowledgeLayer,
|
|
4410
4418
|
updateKnowledge,
|
|
@@ -10574,6 +10582,7 @@ export {
|
|
|
10574
10582
|
createManagedPool,
|
|
10575
10583
|
createNotificationSettings,
|
|
10576
10584
|
createThreadId,
|
|
10585
|
+
defineAiTool,
|
|
10577
10586
|
deprecate,
|
|
10578
10587
|
deprecateIf,
|
|
10579
10588
|
detectDupes,
|