@liveblocks/core 2.25.0-aiprivatebeta1 → 2.25.0-aiprivatebeta11
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 +378 -305
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +263 -118
- package/dist/index.d.ts +263 -118
- package/dist/index.js +294 -221
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
package/dist/index.cjs
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-aiprivatebeta11";
|
|
10
10
|
var PKG_FORMAT = "cjs";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -188,6 +188,9 @@ var warnWithTitle = wrapWithTitle("warn");
|
|
|
188
188
|
var errorWithTitle = wrapWithTitle("error");
|
|
189
189
|
|
|
190
190
|
// src/lib/guards.ts
|
|
191
|
+
function isDefined(value) {
|
|
192
|
+
return value !== null && value !== void 0;
|
|
193
|
+
}
|
|
191
194
|
function isPlainObject(blob) {
|
|
192
195
|
return blob !== null && typeof blob === "object" && Object.prototype.toString.call(blob) === "[object Object]";
|
|
193
196
|
}
|
|
@@ -3685,11 +3688,6 @@ function parseAuthToken(rawTokenString) {
|
|
|
3685
3688
|
function appendDelta(content, delta) {
|
|
3686
3689
|
const lastPart = content[content.length - 1];
|
|
3687
3690
|
switch (delta.type) {
|
|
3688
|
-
case "reasoning":
|
|
3689
|
-
case "text":
|
|
3690
|
-
case "tool-call":
|
|
3691
|
-
content.push(delta);
|
|
3692
|
-
break;
|
|
3693
3691
|
case "text-delta":
|
|
3694
3692
|
if (_optionalChain([lastPart, 'optionalAccess', _55 => _55.type]) === "text") {
|
|
3695
3693
|
lastPart.text += delta.textDelta;
|
|
@@ -3700,15 +3698,16 @@ function appendDelta(content, delta) {
|
|
|
3700
3698
|
case "reasoning-delta":
|
|
3701
3699
|
if (_optionalChain([lastPart, 'optionalAccess', _56 => _56.type]) === "reasoning") {
|
|
3702
3700
|
lastPart.text += delta.textDelta;
|
|
3703
|
-
lastPart.signature ??= delta.signature;
|
|
3704
3701
|
} else {
|
|
3705
3702
|
content.push({
|
|
3706
3703
|
type: "reasoning",
|
|
3707
|
-
text: _nullishCoalesce(delta.textDelta, () => ( ""))
|
|
3708
|
-
signature: delta.signature
|
|
3704
|
+
text: _nullishCoalesce(delta.textDelta, () => ( ""))
|
|
3709
3705
|
});
|
|
3710
3706
|
}
|
|
3711
3707
|
break;
|
|
3708
|
+
case "tool-invocation":
|
|
3709
|
+
content.push(delta);
|
|
3710
|
+
break;
|
|
3712
3711
|
default:
|
|
3713
3712
|
return assertNever(delta, "Unhandled case");
|
|
3714
3713
|
}
|
|
@@ -3716,48 +3715,131 @@ function appendDelta(content, delta) {
|
|
|
3716
3715
|
|
|
3717
3716
|
// src/ai.ts
|
|
3718
3717
|
var DEFAULT_REQUEST_TIMEOUT = 4e3;
|
|
3719
|
-
|
|
3718
|
+
function defineAiTool() {
|
|
3719
|
+
return (def) => {
|
|
3720
|
+
return def;
|
|
3721
|
+
};
|
|
3722
|
+
}
|
|
3723
|
+
var KnowledgeStack = class {
|
|
3724
|
+
#_layers;
|
|
3725
|
+
#stack;
|
|
3726
|
+
// / \
|
|
3727
|
+
// knowledge key "layer" key
|
|
3728
|
+
// (random, or optionally (one entry per mounted component)
|
|
3729
|
+
// set by user)
|
|
3730
|
+
#_cache;
|
|
3731
|
+
constructor() {
|
|
3732
|
+
this.#_layers = /* @__PURE__ */ new Set();
|
|
3733
|
+
this.#stack = new DefaultMap(
|
|
3734
|
+
() => /* @__PURE__ */ new Map()
|
|
3735
|
+
);
|
|
3736
|
+
this.#_cache = void 0;
|
|
3737
|
+
}
|
|
3738
|
+
// Typically a useId()
|
|
3739
|
+
registerLayer(uniqueLayerId) {
|
|
3740
|
+
const layerKey = uniqueLayerId;
|
|
3741
|
+
if (this.#_layers.has(layerKey))
|
|
3742
|
+
raise(`Layer '${layerKey}' already exists, provide a unique layer id`);
|
|
3743
|
+
this.#_layers.add(layerKey);
|
|
3744
|
+
return layerKey;
|
|
3745
|
+
}
|
|
3746
|
+
deregisterLayer(layerKey) {
|
|
3747
|
+
this.#_layers.delete(layerKey);
|
|
3748
|
+
let deleted = false;
|
|
3749
|
+
for (const [key, knowledge] of this.#stack) {
|
|
3750
|
+
if (knowledge.delete(layerKey)) {
|
|
3751
|
+
deleted = true;
|
|
3752
|
+
}
|
|
3753
|
+
if (knowledge.size === 0)
|
|
3754
|
+
this.#stack.delete(key);
|
|
3755
|
+
}
|
|
3756
|
+
if (deleted) {
|
|
3757
|
+
this.invalidate();
|
|
3758
|
+
}
|
|
3759
|
+
}
|
|
3760
|
+
get() {
|
|
3761
|
+
return this.#_cache ??= this.#recompute();
|
|
3762
|
+
}
|
|
3763
|
+
invalidate() {
|
|
3764
|
+
this.#_cache = void 0;
|
|
3765
|
+
}
|
|
3766
|
+
#recompute() {
|
|
3767
|
+
return Array.from(this.#stack.values()).flatMap(
|
|
3768
|
+
(layer) => (
|
|
3769
|
+
// Return only the last item (returns [] when empty)
|
|
3770
|
+
Array.from(layer.values()).slice(-1).filter(isDefined)
|
|
3771
|
+
)
|
|
3772
|
+
);
|
|
3773
|
+
}
|
|
3774
|
+
updateKnowledge(layerKey, key, data) {
|
|
3775
|
+
if (!this.#_layers.has(layerKey)) raise(`Unknown layer key: ${layerKey}`);
|
|
3776
|
+
this.#stack.getOrCreate(key).set(layerKey, data);
|
|
3777
|
+
this.invalidate();
|
|
3778
|
+
}
|
|
3779
|
+
};
|
|
3720
3780
|
function now() {
|
|
3721
3781
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
3722
3782
|
}
|
|
3783
|
+
var kWILDCARD = Symbol("*");
|
|
3723
3784
|
function createStore_forTools() {
|
|
3724
|
-
const toolsByChatId\u03A3 = new DefaultMap(
|
|
3725
|
-
|
|
3726
|
-
return new
|
|
3785
|
+
const toolsByChatId\u03A3 = new DefaultMap(
|
|
3786
|
+
(_chatId) => {
|
|
3787
|
+
return new DefaultMap((_name) => {
|
|
3788
|
+
return new Signal(void 0);
|
|
3789
|
+
});
|
|
3790
|
+
}
|
|
3791
|
+
);
|
|
3792
|
+
const globalOrScopedTool\u03A3 = new DefaultMap((nameAndChat) => {
|
|
3793
|
+
const [name, chatId] = tryParseJson(nameAndChat);
|
|
3794
|
+
return DerivedSignal.from(() => {
|
|
3795
|
+
return (
|
|
3796
|
+
// A tool that's registered and scoped to a specific chat ID...
|
|
3797
|
+
_nullishCoalesce(_optionalChain([(chatId !== void 0 ? _optionalChain([toolsByChatId\u03A3, 'access', _57 => _57.get, 'call', _58 => _58(chatId), 'optionalAccess', _59 => _59.get, 'call', _60 => _60(name)]) : void 0), 'optionalAccess', _61 => _61.get, 'call', _62 => _62()]), () => ( // ...or a globally registered tool
|
|
3798
|
+
_optionalChain([toolsByChatId\u03A3, 'access', _63 => _63.getOrCreate, 'call', _64 => _64(kWILDCARD), 'access', _65 => _65.get, 'call', _66 => _66(name), 'optionalAccess', _67 => _67.get, 'call', _68 => _68()])))
|
|
3799
|
+
);
|
|
3727
3800
|
});
|
|
3728
3801
|
});
|
|
3729
|
-
function
|
|
3730
|
-
|
|
3802
|
+
function getTool\u03A3(name, chatId) {
|
|
3803
|
+
const key = JSON.stringify(chatId !== void 0 ? [name, chatId] : [name]);
|
|
3804
|
+
return globalOrScopedTool\u03A3.getOrCreate(key);
|
|
3731
3805
|
}
|
|
3732
|
-
function
|
|
3733
|
-
|
|
3806
|
+
function registerTool(name, tool, chatId) {
|
|
3807
|
+
if (!tool.execute && !tool.render) {
|
|
3808
|
+
throw new Error(
|
|
3809
|
+
"A tool definition must have an execute() function, a render() function, or both."
|
|
3810
|
+
);
|
|
3811
|
+
}
|
|
3812
|
+
const key = _nullishCoalesce(chatId, () => ( kWILDCARD));
|
|
3813
|
+
toolsByChatId\u03A3.getOrCreate(key).getOrCreate(name).set(tool);
|
|
3814
|
+
return () => unregisterTool(key, name);
|
|
3734
3815
|
}
|
|
3735
|
-
function
|
|
3816
|
+
function unregisterTool(chatId, name) {
|
|
3736
3817
|
const tools = toolsByChatId\u03A3.get(chatId);
|
|
3737
3818
|
if (tools === void 0) return;
|
|
3738
|
-
const tool = tools.get(
|
|
3819
|
+
const tool = tools.get(name);
|
|
3739
3820
|
if (tool === void 0) return;
|
|
3740
3821
|
tool.set(void 0);
|
|
3741
3822
|
}
|
|
3742
|
-
function
|
|
3743
|
-
const
|
|
3744
|
-
|
|
3745
|
-
return Array.from(
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
};
|
|
3751
|
-
})
|
|
3823
|
+
function getToolDescriptions(chatId) {
|
|
3824
|
+
const globalTools\u03A3 = toolsByChatId\u03A3.get(kWILDCARD);
|
|
3825
|
+
const scopedTools\u03A3 = toolsByChatId\u03A3.get(chatId);
|
|
3826
|
+
return Array.from([
|
|
3827
|
+
..._nullishCoalesce(_optionalChain([globalTools\u03A3, 'optionalAccess', _69 => _69.entries, 'call', _70 => _70()]), () => ( [])),
|
|
3828
|
+
..._nullishCoalesce(_optionalChain([scopedTools\u03A3, 'optionalAccess', _71 => _71.entries, 'call', _72 => _72()]), () => ( []))
|
|
3829
|
+
]).flatMap(([name, tool\u03A3]) => {
|
|
3830
|
+
const tool = tool\u03A3.get();
|
|
3831
|
+
return tool ? [{ name, description: tool.description, parameters: tool.parameters }] : [];
|
|
3832
|
+
});
|
|
3752
3833
|
}
|
|
3753
3834
|
return {
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
removeToolDefinition
|
|
3835
|
+
getToolDescriptions,
|
|
3836
|
+
getTool\u03A3,
|
|
3837
|
+
registerTool
|
|
3758
3838
|
};
|
|
3759
3839
|
}
|
|
3760
|
-
function createStore_forChatMessages() {
|
|
3840
|
+
function createStore_forChatMessages(toolsStore, setToolResult) {
|
|
3841
|
+
const autoExecutableMessages = /* @__PURE__ */ new Set();
|
|
3842
|
+
const seenToolCallIds = /* @__PURE__ */ new Set();
|
|
3761
3843
|
const messagePoolByChatId\u03A3 = new DefaultMap(
|
|
3762
3844
|
(_chatId) => new MutableSignal(
|
|
3763
3845
|
new TreePool(
|
|
@@ -3767,7 +3849,7 @@ function createStore_forChatMessages() {
|
|
|
3767
3849
|
)
|
|
3768
3850
|
)
|
|
3769
3851
|
);
|
|
3770
|
-
const
|
|
3852
|
+
const generatingMessages\u03A3 = new MutableSignal(
|
|
3771
3853
|
/* @__PURE__ */ new Map()
|
|
3772
3854
|
);
|
|
3773
3855
|
function createOptimistically(chatId, role, parentId, third) {
|
|
@@ -3781,7 +3863,8 @@ function createStore_forChatMessages() {
|
|
|
3781
3863
|
role,
|
|
3782
3864
|
parentId,
|
|
3783
3865
|
createdAt,
|
|
3784
|
-
content
|
|
3866
|
+
content,
|
|
3867
|
+
_optimistic: true
|
|
3785
3868
|
});
|
|
3786
3869
|
} else {
|
|
3787
3870
|
upsert({
|
|
@@ -3790,8 +3873,9 @@ function createStore_forChatMessages() {
|
|
|
3790
3873
|
role,
|
|
3791
3874
|
parentId,
|
|
3792
3875
|
createdAt,
|
|
3793
|
-
status: "
|
|
3794
|
-
contentSoFar: []
|
|
3876
|
+
status: "generating",
|
|
3877
|
+
contentSoFar: [],
|
|
3878
|
+
_optimistic: true
|
|
3795
3879
|
});
|
|
3796
3880
|
}
|
|
3797
3881
|
return id;
|
|
@@ -3808,7 +3892,7 @@ function createStore_forChatMessages() {
|
|
|
3808
3892
|
if (!chatMsgs\u03A3) return;
|
|
3809
3893
|
const existing = chatMsgs\u03A3.get().get(messageId);
|
|
3810
3894
|
if (!existing || existing.deletedAt) return;
|
|
3811
|
-
if (existing.role === "assistant" &&
|
|
3895
|
+
if (existing.role === "assistant" && existing.status !== "completed") {
|
|
3812
3896
|
upsert({ ...existing, deletedAt: now(), contentSoFar: [] });
|
|
3813
3897
|
} else {
|
|
3814
3898
|
upsert({ ...existing, deletedAt: now(), content: [] });
|
|
@@ -3823,19 +3907,59 @@ function createStore_forChatMessages() {
|
|
|
3823
3907
|
batch(() => {
|
|
3824
3908
|
const chatMsgs\u03A3 = messagePoolByChatId\u03A3.getOrCreate(message.chatId);
|
|
3825
3909
|
chatMsgs\u03A3.mutate((pool) => pool.upsert(message));
|
|
3826
|
-
if (message.role === "assistant" && message.status === "
|
|
3827
|
-
|
|
3910
|
+
if (message.role === "assistant" && message.status === "generating") {
|
|
3911
|
+
generatingMessages\u03A3.mutate((lut) => {
|
|
3828
3912
|
lut.set(message.id, structuredClone(message));
|
|
3829
3913
|
});
|
|
3830
3914
|
} else {
|
|
3831
|
-
|
|
3915
|
+
generatingMessages\u03A3.mutate((lut) => {
|
|
3832
3916
|
lut.delete(message.id);
|
|
3833
3917
|
});
|
|
3834
3918
|
}
|
|
3919
|
+
if (message.role === "assistant" && message.status === "awaiting-tool") {
|
|
3920
|
+
for (const toolCall of message.contentSoFar.filter(
|
|
3921
|
+
(part) => part.type === "tool-invocation" && part.status === "executing"
|
|
3922
|
+
)) {
|
|
3923
|
+
if (seenToolCallIds.has(toolCall.toolCallId)) {
|
|
3924
|
+
continue;
|
|
3925
|
+
}
|
|
3926
|
+
seenToolCallIds.add(toolCall.toolCallId);
|
|
3927
|
+
const toolDef = toolsStore.getTool\u03A3(toolCall.toolName, message.chatId).get();
|
|
3928
|
+
const respondSync = (result) => {
|
|
3929
|
+
setToolResult(
|
|
3930
|
+
message.chatId,
|
|
3931
|
+
message.id,
|
|
3932
|
+
toolCall.toolCallId,
|
|
3933
|
+
result
|
|
3934
|
+
// TODO Pass in AiGenerationOptions here, or make the backend use the same options
|
|
3935
|
+
).catch((err) => {
|
|
3936
|
+
error2(
|
|
3937
|
+
`Error trying to respond to tool-call: ${String(err)} (in respond())`
|
|
3938
|
+
);
|
|
3939
|
+
});
|
|
3940
|
+
};
|
|
3941
|
+
const executeFn = _optionalChain([toolDef, 'optionalAccess', _73 => _73.execute]);
|
|
3942
|
+
if (executeFn && autoExecutableMessages.has(message.id)) {
|
|
3943
|
+
(async () => {
|
|
3944
|
+
const result = await executeFn(toolCall.args, {
|
|
3945
|
+
toolName: toolCall.toolName,
|
|
3946
|
+
toolCallId: toolCall.toolCallId
|
|
3947
|
+
});
|
|
3948
|
+
respondSync(result);
|
|
3949
|
+
})().catch((err) => {
|
|
3950
|
+
error2(
|
|
3951
|
+
`Error trying to respond to tool-call: ${String(err)} (in execute())`
|
|
3952
|
+
);
|
|
3953
|
+
});
|
|
3954
|
+
}
|
|
3955
|
+
}
|
|
3956
|
+
} else {
|
|
3957
|
+
autoExecutableMessages.delete(message.id);
|
|
3958
|
+
}
|
|
3835
3959
|
});
|
|
3836
3960
|
}
|
|
3837
3961
|
function addDelta(messageId, delta) {
|
|
3838
|
-
|
|
3962
|
+
generatingMessages\u03A3.mutate((lut) => {
|
|
3839
3963
|
const message = lut.get(messageId);
|
|
3840
3964
|
if (message === void 0) return false;
|
|
3841
3965
|
appendDelta(message.contentSoFar, delta);
|
|
@@ -3843,10 +3967,10 @@ function createStore_forChatMessages() {
|
|
|
3843
3967
|
return true;
|
|
3844
3968
|
});
|
|
3845
3969
|
}
|
|
3846
|
-
function*
|
|
3970
|
+
function* iterGeneratingMessages() {
|
|
3847
3971
|
for (const chatMsgs\u03A3 of messagePoolByChatId\u03A3.values()) {
|
|
3848
3972
|
for (const m of chatMsgs\u03A3.get()) {
|
|
3849
|
-
if (m.role === "assistant" && m.status === "
|
|
3973
|
+
if (m.role === "assistant" && m.status === "generating" && !m._optimistic) {
|
|
3850
3974
|
yield m;
|
|
3851
3975
|
}
|
|
3852
3976
|
}
|
|
@@ -3854,9 +3978,18 @@ function createStore_forChatMessages() {
|
|
|
3854
3978
|
}
|
|
3855
3979
|
function failAllPending() {
|
|
3856
3980
|
batch(() => {
|
|
3857
|
-
|
|
3981
|
+
generatingMessages\u03A3.mutate((lut) => {
|
|
3982
|
+
let deleted = false;
|
|
3983
|
+
for (const [k, v] of lut) {
|
|
3984
|
+
if (!v._optimistic) {
|
|
3985
|
+
lut.delete(k);
|
|
3986
|
+
deleted = true;
|
|
3987
|
+
}
|
|
3988
|
+
}
|
|
3989
|
+
return deleted;
|
|
3990
|
+
});
|
|
3858
3991
|
upsertMany(
|
|
3859
|
-
Array.from(
|
|
3992
|
+
Array.from(iterGeneratingMessages()).map(
|
|
3860
3993
|
(message) => ({
|
|
3861
3994
|
...message,
|
|
3862
3995
|
status: "failed",
|
|
@@ -3891,11 +4024,20 @@ function createStore_forChatMessages() {
|
|
|
3891
4024
|
}
|
|
3892
4025
|
function selectSpine(leaf) {
|
|
3893
4026
|
const spine = [];
|
|
4027
|
+
let lastVisitedMessage = null;
|
|
3894
4028
|
for (const message2 of pool.walkUp(leaf.id)) {
|
|
3895
|
-
const prev = _nullishCoalesce(_optionalChain([first, 'call',
|
|
3896
|
-
const next = _nullishCoalesce(_optionalChain([first, 'call',
|
|
4029
|
+
const prev = _nullishCoalesce(_optionalChain([first, 'call', _74 => _74(pool.walkLeft(message2.id, isAlive)), 'optionalAccess', _75 => _75.id]), () => ( null));
|
|
4030
|
+
const next = _nullishCoalesce(_optionalChain([first, 'call', _76 => _76(pool.walkRight(message2.id, isAlive)), 'optionalAccess', _77 => _77.id]), () => ( null));
|
|
3897
4031
|
if (!message2.deletedAt || prev || next) {
|
|
3898
|
-
|
|
4032
|
+
const node = {
|
|
4033
|
+
...message2,
|
|
4034
|
+
navigation: { parent: null, prev, next }
|
|
4035
|
+
};
|
|
4036
|
+
if (lastVisitedMessage !== null) {
|
|
4037
|
+
lastVisitedMessage.navigation.parent = node.id;
|
|
4038
|
+
}
|
|
4039
|
+
lastVisitedMessage = node;
|
|
4040
|
+
spine.push(node);
|
|
3899
4041
|
}
|
|
3900
4042
|
}
|
|
3901
4043
|
return spine.reverse();
|
|
@@ -3921,18 +4063,6 @@ function createStore_forChatMessages() {
|
|
|
3921
4063
|
}
|
|
3922
4064
|
return fallback();
|
|
3923
4065
|
}
|
|
3924
|
-
function getLatestUserMessageAncestor(chatId, messageId) {
|
|
3925
|
-
const pool = messagePoolByChatId\u03A3.getOrCreate(chatId).get();
|
|
3926
|
-
const message = pool.get(messageId);
|
|
3927
|
-
if (!message) return null;
|
|
3928
|
-
if (message.role === "user") return message.id;
|
|
3929
|
-
for (const m of pool.walkUp(message.id)) {
|
|
3930
|
-
if (m.role === "user" && !m.deletedAt) {
|
|
3931
|
-
return m.id;
|
|
3932
|
-
}
|
|
3933
|
-
}
|
|
3934
|
-
return null;
|
|
3935
|
-
}
|
|
3936
4066
|
const immutableMessagesByBranch = new DefaultMap((chatId) => {
|
|
3937
4067
|
return new DefaultMap((branchId) => {
|
|
3938
4068
|
const messages\u03A3 = DerivedSignal.from(() => {
|
|
@@ -3940,16 +4070,16 @@ function createStore_forChatMessages() {
|
|
|
3940
4070
|
return selectBranch(pool, branchId);
|
|
3941
4071
|
}, shallow2);
|
|
3942
4072
|
return DerivedSignal.from(() => {
|
|
3943
|
-
const
|
|
4073
|
+
const generatingMessages = generatingMessages\u03A3.get();
|
|
3944
4074
|
return messages\u03A3.get().map((message) => {
|
|
3945
|
-
if (message.role !== "assistant" || message.status !== "
|
|
4075
|
+
if (message.role !== "assistant" || message.status !== "generating") {
|
|
3946
4076
|
return message;
|
|
3947
4077
|
}
|
|
3948
|
-
const
|
|
3949
|
-
if (
|
|
4078
|
+
const generatingMessage = generatingMessages.get(message.id);
|
|
4079
|
+
if (generatingMessage === void 0) return message;
|
|
3950
4080
|
return {
|
|
3951
4081
|
...message,
|
|
3952
|
-
contentSoFar:
|
|
4082
|
+
contentSoFar: generatingMessage.contentSoFar
|
|
3953
4083
|
};
|
|
3954
4084
|
});
|
|
3955
4085
|
}, shallow);
|
|
@@ -3958,21 +4088,10 @@ function createStore_forChatMessages() {
|
|
|
3958
4088
|
function getChatMessagesForBranch\u03A3(chatId, branch) {
|
|
3959
4089
|
return immutableMessagesByBranch.getOrCreate(chatId).getOrCreate(branch || null);
|
|
3960
4090
|
}
|
|
3961
|
-
const messagesByChatId\u03A3 = new DefaultMap((chatId) => {
|
|
3962
|
-
return DerivedSignal.from(() => {
|
|
3963
|
-
const pool = messagePoolByChatId\u03A3.getOrCreate(chatId).get();
|
|
3964
|
-
return Array.from(pool.sorted);
|
|
3965
|
-
});
|
|
3966
|
-
});
|
|
3967
|
-
function getMessagesForChat\u03A3(chatId) {
|
|
3968
|
-
return messagesByChatId\u03A3.getOrCreate(chatId);
|
|
3969
|
-
}
|
|
3970
4091
|
return {
|
|
3971
4092
|
// Readers
|
|
3972
4093
|
getMessageById,
|
|
3973
4094
|
getChatMessagesForBranch\u03A3,
|
|
3974
|
-
getMessagesForChat\u03A3,
|
|
3975
|
-
getLatestUserMessageAncestor,
|
|
3976
4095
|
// Mutations
|
|
3977
4096
|
createOptimistically,
|
|
3978
4097
|
upsert,
|
|
@@ -3980,20 +4099,23 @@ function createStore_forChatMessages() {
|
|
|
3980
4099
|
remove,
|
|
3981
4100
|
removeByChatId,
|
|
3982
4101
|
addDelta,
|
|
3983
|
-
failAllPending
|
|
4102
|
+
failAllPending,
|
|
4103
|
+
allowAutoExecuteToolCall(messageId) {
|
|
4104
|
+
autoExecutableMessages.add(messageId);
|
|
4105
|
+
}
|
|
3984
4106
|
};
|
|
3985
4107
|
}
|
|
3986
4108
|
function createStore_forUserAiChats() {
|
|
3987
|
-
const
|
|
4109
|
+
const allChatsInclDeleted\u03A3 = new MutableSignal(
|
|
3988
4110
|
SortedList.with((x, y) => y.createdAt < x.createdAt)
|
|
3989
4111
|
);
|
|
3990
|
-
const
|
|
3991
|
-
() => Array.from(
|
|
4112
|
+
const nonDeletedChats\u03A3 = DerivedSignal.from(
|
|
4113
|
+
() => Array.from(allChatsInclDeleted\u03A3.get()).filter((c) => !c.deletedAt)
|
|
3992
4114
|
);
|
|
3993
4115
|
function upsertMany(chats) {
|
|
3994
|
-
|
|
4116
|
+
allChatsInclDeleted\u03A3.mutate((list) => {
|
|
3995
4117
|
for (const chat of chats) {
|
|
3996
|
-
|
|
4118
|
+
list.removeBy((c) => c.id === chat.id, 1);
|
|
3997
4119
|
list.add(chat);
|
|
3998
4120
|
}
|
|
3999
4121
|
});
|
|
@@ -4001,15 +4123,26 @@ function createStore_forUserAiChats() {
|
|
|
4001
4123
|
function upsert(chat) {
|
|
4002
4124
|
upsertMany([chat]);
|
|
4003
4125
|
}
|
|
4004
|
-
function
|
|
4005
|
-
|
|
4126
|
+
function markDeleted(chatId) {
|
|
4127
|
+
allChatsInclDeleted\u03A3.mutate((list) => {
|
|
4128
|
+
const chat = list.find((c) => c.id === chatId);
|
|
4129
|
+
if (!chat) return false;
|
|
4130
|
+
upsert({ ...chat, deletedAt: now() });
|
|
4131
|
+
return void 0;
|
|
4132
|
+
});
|
|
4133
|
+
}
|
|
4134
|
+
function getChatById(chatId) {
|
|
4135
|
+
return Array.from(allChatsInclDeleted\u03A3.get()).find(
|
|
4136
|
+
(chat) => chat.id === chatId
|
|
4137
|
+
);
|
|
4006
4138
|
}
|
|
4007
4139
|
return {
|
|
4008
|
-
chats\u03A3,
|
|
4140
|
+
chats\u03A3: nonDeletedChats\u03A3,
|
|
4141
|
+
getChatById,
|
|
4009
4142
|
// Mutations
|
|
4010
4143
|
upsert,
|
|
4011
4144
|
upsertMany,
|
|
4012
|
-
|
|
4145
|
+
markDeleted
|
|
4013
4146
|
};
|
|
4014
4147
|
}
|
|
4015
4148
|
function createAi(config) {
|
|
@@ -4019,10 +4152,9 @@ function createAi(config) {
|
|
|
4019
4152
|
false
|
|
4020
4153
|
// AI doesn't have actors (yet, but it will)
|
|
4021
4154
|
);
|
|
4022
|
-
const clientId = nanoid(7);
|
|
4023
4155
|
const chatsStore = createStore_forUserAiChats();
|
|
4024
|
-
const messagesStore = createStore_forChatMessages();
|
|
4025
4156
|
const toolsStore = createStore_forTools();
|
|
4157
|
+
const messagesStore = createStore_forChatMessages(toolsStore, setToolResult);
|
|
4026
4158
|
const context = {
|
|
4027
4159
|
staticSessionInfoSig: new Signal(null),
|
|
4028
4160
|
dynamicSessionInfoSig: new Signal(null),
|
|
@@ -4030,11 +4162,10 @@ function createAi(config) {
|
|
|
4030
4162
|
chatsStore,
|
|
4031
4163
|
messagesStore,
|
|
4032
4164
|
toolsStore,
|
|
4033
|
-
|
|
4165
|
+
knowledge: new KnowledgeStack()
|
|
4034
4166
|
};
|
|
4035
4167
|
let lastTokenKey;
|
|
4036
|
-
function onStatusDidChange(
|
|
4037
|
-
warn("onStatusDidChange", newStatus);
|
|
4168
|
+
function onStatusDidChange(_newStatus) {
|
|
4038
4169
|
const authValue = managedSocket.authValue;
|
|
4039
4170
|
if (authValue !== null) {
|
|
4040
4171
|
const tokenKey = getBearerTokenFromAuthValue(authValue);
|
|
@@ -4070,7 +4201,6 @@ function createAi(config) {
|
|
|
4070
4201
|
}
|
|
4071
4202
|
}
|
|
4072
4203
|
function onDidConnect() {
|
|
4073
|
-
warn("onDidConnect");
|
|
4074
4204
|
}
|
|
4075
4205
|
function onDidDisconnect() {
|
|
4076
4206
|
warn("onDidDisconnect");
|
|
@@ -4090,7 +4220,7 @@ function createAi(config) {
|
|
|
4090
4220
|
if ("event" in msg) {
|
|
4091
4221
|
switch (msg.event) {
|
|
4092
4222
|
case "cmd-failed":
|
|
4093
|
-
_optionalChain([pendingCmd, 'optionalAccess',
|
|
4223
|
+
_optionalChain([pendingCmd, 'optionalAccess', _78 => _78.reject, 'call', _79 => _79(new Error(msg.error))]);
|
|
4094
4224
|
break;
|
|
4095
4225
|
case "delta": {
|
|
4096
4226
|
const { id, delta } = msg;
|
|
@@ -4112,7 +4242,7 @@ function createAi(config) {
|
|
|
4112
4242
|
context.messagesStore.remove(m.chatId, m.id);
|
|
4113
4243
|
}
|
|
4114
4244
|
for (const chatId of _nullishCoalesce(msg["-chats"], () => ( []))) {
|
|
4115
|
-
context.chatsStore.
|
|
4245
|
+
context.chatsStore.markDeleted(chatId);
|
|
4116
4246
|
context.messagesStore.removeByChatId(chatId);
|
|
4117
4247
|
}
|
|
4118
4248
|
for (const chatId of _nullishCoalesce(msg.clear, () => ( []))) {
|
|
@@ -4134,39 +4264,41 @@ function createAi(config) {
|
|
|
4134
4264
|
case "get-chats":
|
|
4135
4265
|
context.chatsStore.upsertMany(msg.chats);
|
|
4136
4266
|
break;
|
|
4137
|
-
case "create-chat":
|
|
4267
|
+
case "get-or-create-chat":
|
|
4138
4268
|
context.chatsStore.upsert(msg.chat);
|
|
4139
4269
|
break;
|
|
4140
4270
|
case "delete-chat":
|
|
4141
|
-
context.chatsStore.
|
|
4271
|
+
context.chatsStore.markDeleted(msg.chatId);
|
|
4142
4272
|
context.messagesStore.removeByChatId(msg.chatId);
|
|
4143
4273
|
break;
|
|
4144
4274
|
case "get-message-tree":
|
|
4145
4275
|
context.chatsStore.upsert(msg.chat);
|
|
4146
4276
|
context.messagesStore.upsertMany(msg.messages);
|
|
4147
4277
|
break;
|
|
4148
|
-
case "add-user-message":
|
|
4149
|
-
context.messagesStore.upsert(msg.message);
|
|
4150
|
-
break;
|
|
4151
4278
|
case "delete-message":
|
|
4152
4279
|
context.messagesStore.remove(msg.chatId, msg.messageId);
|
|
4153
4280
|
break;
|
|
4154
4281
|
case "clear-chat":
|
|
4155
4282
|
context.messagesStore.removeByChatId(msg.chatId);
|
|
4156
4283
|
break;
|
|
4157
|
-
case "ask-
|
|
4158
|
-
if (msg.
|
|
4159
|
-
context.messagesStore.upsert(msg.
|
|
4160
|
-
} else {
|
|
4284
|
+
case "ask-in-chat":
|
|
4285
|
+
if (msg.sourceMessage) {
|
|
4286
|
+
context.messagesStore.upsert(msg.sourceMessage);
|
|
4161
4287
|
}
|
|
4288
|
+
context.messagesStore.upsert(msg.targetMessage);
|
|
4162
4289
|
break;
|
|
4163
4290
|
case "abort-ai":
|
|
4164
4291
|
break;
|
|
4292
|
+
case "set-tool-result":
|
|
4293
|
+
if (msg.ok) {
|
|
4294
|
+
context.messagesStore.upsert(msg.message);
|
|
4295
|
+
}
|
|
4296
|
+
break;
|
|
4165
4297
|
default:
|
|
4166
4298
|
return assertNever(msg, "Unhandled case");
|
|
4167
4299
|
}
|
|
4168
4300
|
}
|
|
4169
|
-
_optionalChain([pendingCmd, 'optionalAccess',
|
|
4301
|
+
_optionalChain([pendingCmd, 'optionalAccess', _80 => _80.resolve, 'call', _81 => _81(msg)]);
|
|
4170
4302
|
}
|
|
4171
4303
|
managedSocket.events.onMessage.subscribe(handleServerMessage);
|
|
4172
4304
|
managedSocket.events.statusDidChange.subscribe(onStatusDidChange);
|
|
@@ -4212,13 +4344,11 @@ function createAi(config) {
|
|
|
4212
4344
|
cursor: options.cursor
|
|
4213
4345
|
});
|
|
4214
4346
|
}
|
|
4215
|
-
function
|
|
4347
|
+
function getOrCreateChat(id, options) {
|
|
4216
4348
|
return sendClientMsgWithResponse({
|
|
4217
|
-
cmd: "create-chat",
|
|
4349
|
+
cmd: "get-or-create-chat",
|
|
4218
4350
|
id,
|
|
4219
|
-
|
|
4220
|
-
ephemeral: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _65 => _65.ephemeral]), () => ( false)),
|
|
4221
|
-
metadata: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _66 => _66.metadata]), () => ( {}))
|
|
4351
|
+
options
|
|
4222
4352
|
});
|
|
4223
4353
|
}
|
|
4224
4354
|
function getMessageTree(chatId) {
|
|
@@ -4227,147 +4357,89 @@ function createAi(config) {
|
|
|
4227
4357
|
chatId
|
|
4228
4358
|
});
|
|
4229
4359
|
}
|
|
4230
|
-
function
|
|
4231
|
-
|
|
4232
|
-
if (chatContext === void 0) {
|
|
4233
|
-
context.contextByChatId.set(chatId, /* @__PURE__ */ new Set([data]));
|
|
4234
|
-
} else {
|
|
4235
|
-
chatContext.add(data);
|
|
4236
|
-
}
|
|
4237
|
-
return () => {
|
|
4238
|
-
const chatContext2 = context.contextByChatId.get(chatId);
|
|
4239
|
-
if (chatContext2 !== void 0) {
|
|
4240
|
-
chatContext2.delete(data);
|
|
4241
|
-
if (chatContext2.size === 0) {
|
|
4242
|
-
context.contextByChatId.delete(chatId);
|
|
4243
|
-
}
|
|
4244
|
-
}
|
|
4245
|
-
};
|
|
4360
|
+
function registerKnowledgeLayer(uniqueLayerId) {
|
|
4361
|
+
return context.knowledge.registerLayer(uniqueLayerId);
|
|
4246
4362
|
}
|
|
4247
|
-
function
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
const
|
|
4255
|
-
const
|
|
4256
|
-
const
|
|
4257
|
-
|
|
4258
|
-
cmd: "ask-ai",
|
|
4363
|
+
function deregisterKnowledgeLayer(layerKey) {
|
|
4364
|
+
context.knowledge.deregisterLayer(layerKey);
|
|
4365
|
+
}
|
|
4366
|
+
function updateKnowledge(layerKey, data, key = nanoid()) {
|
|
4367
|
+
context.knowledge.updateKnowledge(layerKey, key, data);
|
|
4368
|
+
}
|
|
4369
|
+
async function setToolResult(chatId, messageId, toolCallId, result, options) {
|
|
4370
|
+
const knowledge = context.knowledge.get();
|
|
4371
|
+
const tools = context.toolsStore.getToolDescriptions(chatId);
|
|
4372
|
+
const resp = await sendClientMsgWithResponse({
|
|
4373
|
+
cmd: "set-tool-result",
|
|
4259
4374
|
chatId,
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4375
|
+
messageId,
|
|
4376
|
+
toolCallId,
|
|
4377
|
+
result,
|
|
4378
|
+
generationOptions: {
|
|
4379
|
+
copilotId: _optionalChain([options, 'optionalAccess', _82 => _82.copilotId]),
|
|
4380
|
+
stream: _optionalChain([options, 'optionalAccess', _83 => _83.stream]),
|
|
4381
|
+
timeout: _optionalChain([options, 'optionalAccess', _84 => _84.timeout]),
|
|
4382
|
+
// Knowledge and tools aren't coming from the options, but retrieved
|
|
4383
|
+
// from the global context
|
|
4384
|
+
knowledge: knowledge.length > 0 ? knowledge : void 0,
|
|
4385
|
+
tools: tools.length > 0 ? tools : void 0
|
|
4386
|
+
}
|
|
4272
4387
|
});
|
|
4388
|
+
if (resp.ok) {
|
|
4389
|
+
messagesStore.allowAutoExecuteToolCall(resp.message.id);
|
|
4390
|
+
}
|
|
4391
|
+
return resp;
|
|
4273
4392
|
}
|
|
4274
4393
|
return Object.defineProperty(
|
|
4275
4394
|
{
|
|
4276
4395
|
[kInternal]: {
|
|
4277
|
-
|
|
4396
|
+
context
|
|
4278
4397
|
},
|
|
4279
4398
|
connect: () => managedSocket.connect(),
|
|
4280
4399
|
reconnect: () => managedSocket.reconnect(),
|
|
4281
4400
|
disconnect: () => managedSocket.disconnect(),
|
|
4282
4401
|
getChats,
|
|
4283
|
-
|
|
4402
|
+
getOrCreateChat,
|
|
4284
4403
|
deleteChat: (chatId) => {
|
|
4285
|
-
return sendClientMsgWithResponse({
|
|
4286
|
-
cmd: "delete-chat",
|
|
4287
|
-
chatId
|
|
4288
|
-
});
|
|
4404
|
+
return sendClientMsgWithResponse({ cmd: "delete-chat", chatId });
|
|
4289
4405
|
},
|
|
4290
4406
|
getMessageTree,
|
|
4291
4407
|
deleteMessage: (chatId, messageId) => sendClientMsgWithResponse({ cmd: "delete-message", chatId, messageId }),
|
|
4292
4408
|
clearChat: (chatId) => sendClientMsgWithResponse({ cmd: "clear-chat", chatId }),
|
|
4293
|
-
|
|
4294
|
-
const
|
|
4295
|
-
const
|
|
4296
|
-
|
|
4297
|
-
"
|
|
4298
|
-
parentMessageId,
|
|
4299
|
-
content
|
|
4300
|
-
);
|
|
4301
|
-
return sendClientMsgWithResponse({
|
|
4302
|
-
cmd: "add-user-message",
|
|
4303
|
-
id: newMessageId,
|
|
4304
|
-
chatId,
|
|
4305
|
-
parentMessageId,
|
|
4306
|
-
content
|
|
4307
|
-
});
|
|
4308
|
-
},
|
|
4309
|
-
ask,
|
|
4310
|
-
regenerateMessage: (chatId, messageId, options) => {
|
|
4311
|
-
const parentUserMessageId = context.messagesStore.getLatestUserMessageAncestor(chatId, messageId);
|
|
4312
|
-
if (parentUserMessageId === null) {
|
|
4313
|
-
throw new Error(
|
|
4314
|
-
`Unable to find user message ancestor for messageId: ${messageId}`
|
|
4315
|
-
);
|
|
4316
|
-
}
|
|
4317
|
-
return ask(chatId, parentUserMessageId, options);
|
|
4318
|
-
},
|
|
4319
|
-
addUserMessageAndAsk: async (chatId, parentMessageId, message, options) => {
|
|
4320
|
-
const content = [{ type: "text", text: message }];
|
|
4321
|
-
const newMessageId = context.messagesStore.createOptimistically(
|
|
4322
|
-
chatId,
|
|
4323
|
-
"user",
|
|
4324
|
-
parentMessageId,
|
|
4325
|
-
content
|
|
4326
|
-
);
|
|
4327
|
-
const targetMessageId = context.messagesStore.createOptimistically(
|
|
4328
|
-
chatId,
|
|
4329
|
-
"assistant",
|
|
4330
|
-
newMessageId
|
|
4331
|
-
);
|
|
4332
|
-
await sendClientMsgWithResponse({
|
|
4333
|
-
cmd: "add-user-message",
|
|
4334
|
-
id: newMessageId,
|
|
4409
|
+
askUserMessageInChat: async (chatId, userMessage, targetMessageId, options) => {
|
|
4410
|
+
const knowledge = context.knowledge.get();
|
|
4411
|
+
const tools = context.toolsStore.getToolDescriptions(chatId);
|
|
4412
|
+
const resp = await sendClientMsgWithResponse({
|
|
4413
|
+
cmd: "ask-in-chat",
|
|
4335
4414
|
chatId,
|
|
4336
|
-
|
|
4337
|
-
content
|
|
4338
|
-
});
|
|
4339
|
-
const copilotId = _optionalChain([options, 'optionalAccess', _70 => _70.copilotId]);
|
|
4340
|
-
const stream = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _71 => _71.stream]), () => ( false));
|
|
4341
|
-
const timeout = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _72 => _72.timeout]), () => ( DEFAULT_AI_TIMEOUT));
|
|
4342
|
-
const chatContext = context.contextByChatId.get(chatId);
|
|
4343
|
-
return sendClientMsgWithResponse({
|
|
4344
|
-
cmd: "ask-ai",
|
|
4345
|
-
chatId,
|
|
4346
|
-
sourceMessageId: newMessageId,
|
|
4415
|
+
sourceMessage: userMessage,
|
|
4347
4416
|
targetMessageId,
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
context: chatContext ? Array.from(chatContext.values()) : void 0
|
|
4417
|
+
generationOptions: {
|
|
4418
|
+
copilotId: _optionalChain([options, 'optionalAccess', _85 => _85.copilotId]),
|
|
4419
|
+
stream: _optionalChain([options, 'optionalAccess', _86 => _86.stream]),
|
|
4420
|
+
timeout: _optionalChain([options, 'optionalAccess', _87 => _87.timeout]),
|
|
4421
|
+
// Knowledge and tools aren't coming from the options, but retrieved
|
|
4422
|
+
// from the global context
|
|
4423
|
+
knowledge: knowledge.length > 0 ? knowledge : void 0,
|
|
4424
|
+
tools: tools.length > 0 ? tools : void 0
|
|
4425
|
+
}
|
|
4358
4426
|
});
|
|
4427
|
+
messagesStore.allowAutoExecuteToolCall(resp.targetMessage.id);
|
|
4428
|
+
return resp;
|
|
4359
4429
|
},
|
|
4360
4430
|
abort: (messageId) => sendClientMsgWithResponse({ cmd: "abort-ai", messageId }),
|
|
4431
|
+
setToolResult,
|
|
4361
4432
|
getStatus: () => managedSocket.getStatus(),
|
|
4362
4433
|
signals: {
|
|
4363
4434
|
chats\u03A3: context.chatsStore.chats\u03A3,
|
|
4364
4435
|
getChatMessagesForBranch\u03A3: context.messagesStore.getChatMessagesForBranch\u03A3,
|
|
4365
|
-
|
|
4366
|
-
getMessagesForChat\u03A3: context.messagesStore.getMessagesForChat\u03A3
|
|
4436
|
+
getTool\u03A3: context.toolsStore.getTool\u03A3
|
|
4367
4437
|
},
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4438
|
+
getChatById: context.chatsStore.getChatById,
|
|
4439
|
+
registerKnowledgeLayer,
|
|
4440
|
+
deregisterKnowledgeLayer,
|
|
4441
|
+
updateKnowledge,
|
|
4442
|
+
registerTool: context.toolsStore.registerTool
|
|
4371
4443
|
},
|
|
4372
4444
|
kInternal,
|
|
4373
4445
|
{ enumerable: false }
|
|
@@ -4447,7 +4519,7 @@ function createAuthManager(authOptions, onAuthenticate) {
|
|
|
4447
4519
|
return void 0;
|
|
4448
4520
|
}
|
|
4449
4521
|
async function makeAuthRequest(options) {
|
|
4450
|
-
const fetcher = _nullishCoalesce(_optionalChain([authOptions, 'access',
|
|
4522
|
+
const fetcher = _nullishCoalesce(_optionalChain([authOptions, 'access', _88 => _88.polyfills, 'optionalAccess', _89 => _89.fetch]), () => ( (typeof window === "undefined" ? void 0 : window.fetch)));
|
|
4451
4523
|
if (authentication.type === "private") {
|
|
4452
4524
|
if (fetcher === void 0) {
|
|
4453
4525
|
throw new StopRetrying(
|
|
@@ -4463,7 +4535,7 @@ function createAuthManager(authOptions, onAuthenticate) {
|
|
|
4463
4535
|
"The same Liveblocks auth token was issued from the backend before. Caching Liveblocks tokens is not supported."
|
|
4464
4536
|
);
|
|
4465
4537
|
}
|
|
4466
|
-
_optionalChain([onAuthenticate, 'optionalCall',
|
|
4538
|
+
_optionalChain([onAuthenticate, 'optionalCall', _90 => _90(parsed.parsed)]);
|
|
4467
4539
|
return parsed;
|
|
4468
4540
|
}
|
|
4469
4541
|
if (authentication.type === "custom") {
|
|
@@ -4471,7 +4543,7 @@ function createAuthManager(authOptions, onAuthenticate) {
|
|
|
4471
4543
|
if (response && typeof response === "object") {
|
|
4472
4544
|
if (typeof response.token === "string") {
|
|
4473
4545
|
const parsed = parseAuthToken(response.token);
|
|
4474
|
-
_optionalChain([onAuthenticate, 'optionalCall',
|
|
4546
|
+
_optionalChain([onAuthenticate, 'optionalCall', _91 => _91(parsed.parsed)]);
|
|
4475
4547
|
return parsed;
|
|
4476
4548
|
} else if (typeof response.error === "string") {
|
|
4477
4549
|
const reason = `Authentication failed: ${"reason" in response && typeof response.reason === "string" ? response.reason : "Forbidden"}`;
|
|
@@ -4629,7 +4701,7 @@ function sendToPanel(message, options) {
|
|
|
4629
4701
|
...message,
|
|
4630
4702
|
source: "liveblocks-devtools-client"
|
|
4631
4703
|
};
|
|
4632
|
-
if (!(_optionalChain([options, 'optionalAccess',
|
|
4704
|
+
if (!(_optionalChain([options, 'optionalAccess', _92 => _92.force]) || _bridgeActive)) {
|
|
4633
4705
|
return;
|
|
4634
4706
|
}
|
|
4635
4707
|
window.postMessage(fullMsg, "*");
|
|
@@ -4637,7 +4709,7 @@ function sendToPanel(message, options) {
|
|
|
4637
4709
|
var eventSource = makeEventSource();
|
|
4638
4710
|
if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
|
|
4639
4711
|
window.addEventListener("message", (event) => {
|
|
4640
|
-
if (event.source === window && _optionalChain([event, 'access',
|
|
4712
|
+
if (event.source === window && _optionalChain([event, 'access', _93 => _93.data, 'optionalAccess', _94 => _94.source]) === "liveblocks-devtools-panel") {
|
|
4641
4713
|
eventSource.notify(event.data);
|
|
4642
4714
|
} else {
|
|
4643
4715
|
}
|
|
@@ -4779,7 +4851,7 @@ function fullSync(room) {
|
|
|
4779
4851
|
msg: "room::sync::full",
|
|
4780
4852
|
roomId: room.id,
|
|
4781
4853
|
status: room.getStatus(),
|
|
4782
|
-
storage: _nullishCoalesce(_optionalChain([root, 'optionalAccess',
|
|
4854
|
+
storage: _nullishCoalesce(_optionalChain([root, 'optionalAccess', _95 => _95.toTreeNode, 'call', _96 => _96("root"), 'access', _97 => _97.payload]), () => ( null)),
|
|
4783
4855
|
me,
|
|
4784
4856
|
others
|
|
4785
4857
|
});
|
|
@@ -5070,7 +5142,7 @@ function createManagedPool(roomId, options) {
|
|
|
5070
5142
|
generateId: () => `${getCurrentConnectionId()}:${clock++}`,
|
|
5071
5143
|
generateOpId: () => `${getCurrentConnectionId()}:${opClock++}`,
|
|
5072
5144
|
dispatch(ops, reverse, storageUpdates) {
|
|
5073
|
-
_optionalChain([onDispatch, 'optionalCall',
|
|
5145
|
+
_optionalChain([onDispatch, 'optionalCall', _98 => _98(ops, reverse, storageUpdates)]);
|
|
5074
5146
|
},
|
|
5075
5147
|
assertStorageIsWritable: () => {
|
|
5076
5148
|
if (!isStorageWritable()) {
|
|
@@ -5297,7 +5369,7 @@ var LiveRegister = class _LiveRegister extends AbstractCrdt {
|
|
|
5297
5369
|
return [
|
|
5298
5370
|
{
|
|
5299
5371
|
type: 8 /* CREATE_REGISTER */,
|
|
5300
|
-
opId: _optionalChain([pool, 'optionalAccess',
|
|
5372
|
+
opId: _optionalChain([pool, 'optionalAccess', _99 => _99.generateOpId, 'call', _100 => _100()]),
|
|
5301
5373
|
id: this._id,
|
|
5302
5374
|
parentId,
|
|
5303
5375
|
parentKey,
|
|
@@ -5403,7 +5475,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
5403
5475
|
const ops = [];
|
|
5404
5476
|
const op = {
|
|
5405
5477
|
id: this._id,
|
|
5406
|
-
opId: _optionalChain([pool, 'optionalAccess',
|
|
5478
|
+
opId: _optionalChain([pool, 'optionalAccess', _101 => _101.generateOpId, 'call', _102 => _102()]),
|
|
5407
5479
|
type: 2 /* CREATE_LIST */,
|
|
5408
5480
|
parentId,
|
|
5409
5481
|
parentKey
|
|
@@ -5674,7 +5746,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
5674
5746
|
#applyInsertUndoRedo(op) {
|
|
5675
5747
|
const { id, parentKey: key } = op;
|
|
5676
5748
|
const child = creationOpToLiveNode(op);
|
|
5677
|
-
if (_optionalChain([this, 'access',
|
|
5749
|
+
if (_optionalChain([this, 'access', _103 => _103._pool, 'optionalAccess', _104 => _104.getNode, 'call', _105 => _105(id)]) !== void 0) {
|
|
5678
5750
|
return { modified: false };
|
|
5679
5751
|
}
|
|
5680
5752
|
child._attach(id, nn(this._pool));
|
|
@@ -5682,8 +5754,8 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
5682
5754
|
const existingItemIndex = this._indexOfPosition(key);
|
|
5683
5755
|
let newKey = key;
|
|
5684
5756
|
if (existingItemIndex !== -1) {
|
|
5685
|
-
const before2 = _optionalChain([this, 'access',
|
|
5686
|
-
const after2 = _optionalChain([this, 'access',
|
|
5757
|
+
const before2 = _optionalChain([this, 'access', _106 => _106.#items, 'access', _107 => _107[existingItemIndex], 'optionalAccess', _108 => _108._parentPos]);
|
|
5758
|
+
const after2 = _optionalChain([this, 'access', _109 => _109.#items, 'access', _110 => _110[existingItemIndex + 1], 'optionalAccess', _111 => _111._parentPos]);
|
|
5687
5759
|
newKey = makePosition(before2, after2);
|
|
5688
5760
|
child._setParentLink(this, newKey);
|
|
5689
5761
|
}
|
|
@@ -5697,7 +5769,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
5697
5769
|
#applySetUndoRedo(op) {
|
|
5698
5770
|
const { id, parentKey: key } = op;
|
|
5699
5771
|
const child = creationOpToLiveNode(op);
|
|
5700
|
-
if (_optionalChain([this, 'access',
|
|
5772
|
+
if (_optionalChain([this, 'access', _112 => _112._pool, 'optionalAccess', _113 => _113.getNode, 'call', _114 => _114(id)]) !== void 0) {
|
|
5701
5773
|
return { modified: false };
|
|
5702
5774
|
}
|
|
5703
5775
|
this.#unacknowledgedSets.set(key, nn(op.opId));
|
|
@@ -5818,7 +5890,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
5818
5890
|
} else {
|
|
5819
5891
|
this.#items[existingItemIndex]._setParentLink(
|
|
5820
5892
|
this,
|
|
5821
|
-
makePosition(newKey, _optionalChain([this, 'access',
|
|
5893
|
+
makePosition(newKey, _optionalChain([this, 'access', _115 => _115.#items, 'access', _116 => _116[existingItemIndex + 1], 'optionalAccess', _117 => _117._parentPos]))
|
|
5822
5894
|
);
|
|
5823
5895
|
const previousIndex = this.#items.indexOf(child);
|
|
5824
5896
|
child._setParentLink(this, newKey);
|
|
@@ -5843,7 +5915,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
5843
5915
|
if (existingItemIndex !== -1) {
|
|
5844
5916
|
this.#items[existingItemIndex]._setParentLink(
|
|
5845
5917
|
this,
|
|
5846
|
-
makePosition(newKey, _optionalChain([this, 'access',
|
|
5918
|
+
makePosition(newKey, _optionalChain([this, 'access', _118 => _118.#items, 'access', _119 => _119[existingItemIndex + 1], 'optionalAccess', _120 => _120._parentPos]))
|
|
5847
5919
|
);
|
|
5848
5920
|
}
|
|
5849
5921
|
child._setParentLink(this, newKey);
|
|
@@ -5862,7 +5934,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
5862
5934
|
if (existingItemIndex !== -1) {
|
|
5863
5935
|
this.#items[existingItemIndex]._setParentLink(
|
|
5864
5936
|
this,
|
|
5865
|
-
makePosition(newKey, _optionalChain([this, 'access',
|
|
5937
|
+
makePosition(newKey, _optionalChain([this, 'access', _121 => _121.#items, 'access', _122 => _122[existingItemIndex + 1], 'optionalAccess', _123 => _123._parentPos]))
|
|
5866
5938
|
);
|
|
5867
5939
|
}
|
|
5868
5940
|
child._setParentLink(this, newKey);
|
|
@@ -5889,7 +5961,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
5889
5961
|
if (existingItemIndex !== -1) {
|
|
5890
5962
|
this.#items[existingItemIndex]._setParentLink(
|
|
5891
5963
|
this,
|
|
5892
|
-
makePosition(newKey, _optionalChain([this, 'access',
|
|
5964
|
+
makePosition(newKey, _optionalChain([this, 'access', _124 => _124.#items, 'access', _125 => _125[existingItemIndex + 1], 'optionalAccess', _126 => _126._parentPos]))
|
|
5893
5965
|
);
|
|
5894
5966
|
}
|
|
5895
5967
|
child._setParentLink(this, newKey);
|
|
@@ -5947,7 +6019,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
5947
6019
|
* @param element The element to add to the end of the LiveList.
|
|
5948
6020
|
*/
|
|
5949
6021
|
push(element) {
|
|
5950
|
-
_optionalChain([this, 'access',
|
|
6022
|
+
_optionalChain([this, 'access', _127 => _127._pool, 'optionalAccess', _128 => _128.assertStorageIsWritable, 'call', _129 => _129()]);
|
|
5951
6023
|
return this.insert(element, this.length);
|
|
5952
6024
|
}
|
|
5953
6025
|
/**
|
|
@@ -5956,7 +6028,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
5956
6028
|
* @param index The index at which you want to insert the element.
|
|
5957
6029
|
*/
|
|
5958
6030
|
insert(element, index) {
|
|
5959
|
-
_optionalChain([this, 'access',
|
|
6031
|
+
_optionalChain([this, 'access', _130 => _130._pool, 'optionalAccess', _131 => _131.assertStorageIsWritable, 'call', _132 => _132()]);
|
|
5960
6032
|
if (index < 0 || index > this.#items.length) {
|
|
5961
6033
|
throw new Error(
|
|
5962
6034
|
`Cannot insert list item at index "${index}". index should be between 0 and ${this.#items.length}`
|
|
@@ -5986,7 +6058,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
5986
6058
|
* @param targetIndex The index where the element should be after moving.
|
|
5987
6059
|
*/
|
|
5988
6060
|
move(index, targetIndex) {
|
|
5989
|
-
_optionalChain([this, 'access',
|
|
6061
|
+
_optionalChain([this, 'access', _133 => _133._pool, 'optionalAccess', _134 => _134.assertStorageIsWritable, 'call', _135 => _135()]);
|
|
5990
6062
|
if (targetIndex < 0) {
|
|
5991
6063
|
throw new Error("targetIndex cannot be less than 0");
|
|
5992
6064
|
}
|
|
@@ -6044,7 +6116,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6044
6116
|
* @param index The index of the element to delete
|
|
6045
6117
|
*/
|
|
6046
6118
|
delete(index) {
|
|
6047
|
-
_optionalChain([this, 'access',
|
|
6119
|
+
_optionalChain([this, 'access', _136 => _136._pool, 'optionalAccess', _137 => _137.assertStorageIsWritable, 'call', _138 => _138()]);
|
|
6048
6120
|
if (index < 0 || index >= this.#items.length) {
|
|
6049
6121
|
throw new Error(
|
|
6050
6122
|
`Cannot delete list item at index "${index}". index should be between 0 and ${this.#items.length - 1}`
|
|
@@ -6077,7 +6149,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6077
6149
|
}
|
|
6078
6150
|
}
|
|
6079
6151
|
clear() {
|
|
6080
|
-
_optionalChain([this, 'access',
|
|
6152
|
+
_optionalChain([this, 'access', _139 => _139._pool, 'optionalAccess', _140 => _140.assertStorageIsWritable, 'call', _141 => _141()]);
|
|
6081
6153
|
if (this._pool) {
|
|
6082
6154
|
const ops = [];
|
|
6083
6155
|
const reverseOps = [];
|
|
@@ -6111,7 +6183,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6111
6183
|
}
|
|
6112
6184
|
}
|
|
6113
6185
|
set(index, item) {
|
|
6114
|
-
_optionalChain([this, 'access',
|
|
6186
|
+
_optionalChain([this, 'access', _142 => _142._pool, 'optionalAccess', _143 => _143.assertStorageIsWritable, 'call', _144 => _144()]);
|
|
6115
6187
|
if (index < 0 || index >= this.#items.length) {
|
|
6116
6188
|
throw new Error(
|
|
6117
6189
|
`Cannot set list item at index "${index}". index should be between 0 and ${this.#items.length - 1}`
|
|
@@ -6257,7 +6329,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6257
6329
|
#shiftItemPosition(index, key) {
|
|
6258
6330
|
const shiftedPosition = makePosition(
|
|
6259
6331
|
key,
|
|
6260
|
-
this.#items.length > index + 1 ? _optionalChain([this, 'access',
|
|
6332
|
+
this.#items.length > index + 1 ? _optionalChain([this, 'access', _145 => _145.#items, 'access', _146 => _146[index + 1], 'optionalAccess', _147 => _147._parentPos]) : void 0
|
|
6261
6333
|
);
|
|
6262
6334
|
this.#items[index]._setParentLink(this, shiftedPosition);
|
|
6263
6335
|
}
|
|
@@ -6382,7 +6454,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
6382
6454
|
const ops = [];
|
|
6383
6455
|
const op = {
|
|
6384
6456
|
id: this._id,
|
|
6385
|
-
opId: _optionalChain([pool, 'optionalAccess',
|
|
6457
|
+
opId: _optionalChain([pool, 'optionalAccess', _148 => _148.generateOpId, 'call', _149 => _149()]),
|
|
6386
6458
|
type: 7 /* CREATE_MAP */,
|
|
6387
6459
|
parentId,
|
|
6388
6460
|
parentKey
|
|
@@ -6517,7 +6589,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
6517
6589
|
* @param value The value of the element to add. Should be serializable to JSON.
|
|
6518
6590
|
*/
|
|
6519
6591
|
set(key, value) {
|
|
6520
|
-
_optionalChain([this, 'access',
|
|
6592
|
+
_optionalChain([this, 'access', _150 => _150._pool, 'optionalAccess', _151 => _151.assertStorageIsWritable, 'call', _152 => _152()]);
|
|
6521
6593
|
const oldValue = this.#map.get(key);
|
|
6522
6594
|
if (oldValue) {
|
|
6523
6595
|
oldValue._detach();
|
|
@@ -6563,7 +6635,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
6563
6635
|
* @returns true if an element existed and has been removed, or false if the element does not exist.
|
|
6564
6636
|
*/
|
|
6565
6637
|
delete(key) {
|
|
6566
|
-
_optionalChain([this, 'access',
|
|
6638
|
+
_optionalChain([this, 'access', _153 => _153._pool, 'optionalAccess', _154 => _154.assertStorageIsWritable, 'call', _155 => _155()]);
|
|
6567
6639
|
const item = this.#map.get(key);
|
|
6568
6640
|
if (item === void 0) {
|
|
6569
6641
|
return false;
|
|
@@ -6742,7 +6814,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
|
|
|
6742
6814
|
if (this._id === void 0) {
|
|
6743
6815
|
throw new Error("Cannot serialize item is not attached");
|
|
6744
6816
|
}
|
|
6745
|
-
const opId = _optionalChain([pool, 'optionalAccess',
|
|
6817
|
+
const opId = _optionalChain([pool, 'optionalAccess', _156 => _156.generateOpId, 'call', _157 => _157()]);
|
|
6746
6818
|
const ops = [];
|
|
6747
6819
|
const op = {
|
|
6748
6820
|
type: 4 /* CREATE_OBJECT */,
|
|
@@ -7014,7 +7086,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
|
|
|
7014
7086
|
* @param value The value of the property to add
|
|
7015
7087
|
*/
|
|
7016
7088
|
set(key, value) {
|
|
7017
|
-
_optionalChain([this, 'access',
|
|
7089
|
+
_optionalChain([this, 'access', _158 => _158._pool, 'optionalAccess', _159 => _159.assertStorageIsWritable, 'call', _160 => _160()]);
|
|
7018
7090
|
this.update({ [key]: value });
|
|
7019
7091
|
}
|
|
7020
7092
|
/**
|
|
@@ -7029,7 +7101,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
|
|
|
7029
7101
|
* @param key The key of the property to delete
|
|
7030
7102
|
*/
|
|
7031
7103
|
delete(key) {
|
|
7032
|
-
_optionalChain([this, 'access',
|
|
7104
|
+
_optionalChain([this, 'access', _161 => _161._pool, 'optionalAccess', _162 => _162.assertStorageIsWritable, 'call', _163 => _163()]);
|
|
7033
7105
|
const keyAsString = key;
|
|
7034
7106
|
const oldValue = this.#map.get(keyAsString);
|
|
7035
7107
|
if (oldValue === void 0) {
|
|
@@ -7082,7 +7154,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
|
|
|
7082
7154
|
* @param patch The object used to overrides properties
|
|
7083
7155
|
*/
|
|
7084
7156
|
update(patch) {
|
|
7085
|
-
_optionalChain([this, 'access',
|
|
7157
|
+
_optionalChain([this, 'access', _164 => _164._pool, 'optionalAccess', _165 => _165.assertStorageIsWritable, 'call', _166 => _166()]);
|
|
7086
7158
|
if (this._pool === void 0 || this._id === void 0) {
|
|
7087
7159
|
for (const key in patch) {
|
|
7088
7160
|
const newValue = patch[key];
|
|
@@ -7805,15 +7877,15 @@ function installBackgroundTabSpy() {
|
|
|
7805
7877
|
const doc = typeof document !== "undefined" ? document : void 0;
|
|
7806
7878
|
const inBackgroundSince = { current: null };
|
|
7807
7879
|
function onVisibilityChange() {
|
|
7808
|
-
if (_optionalChain([doc, 'optionalAccess',
|
|
7880
|
+
if (_optionalChain([doc, 'optionalAccess', _167 => _167.visibilityState]) === "hidden") {
|
|
7809
7881
|
inBackgroundSince.current = _nullishCoalesce(inBackgroundSince.current, () => ( Date.now()));
|
|
7810
7882
|
} else {
|
|
7811
7883
|
inBackgroundSince.current = null;
|
|
7812
7884
|
}
|
|
7813
7885
|
}
|
|
7814
|
-
_optionalChain([doc, 'optionalAccess',
|
|
7886
|
+
_optionalChain([doc, 'optionalAccess', _168 => _168.addEventListener, 'call', _169 => _169("visibilitychange", onVisibilityChange)]);
|
|
7815
7887
|
const unsub = () => {
|
|
7816
|
-
_optionalChain([doc, 'optionalAccess',
|
|
7888
|
+
_optionalChain([doc, 'optionalAccess', _170 => _170.removeEventListener, 'call', _171 => _171("visibilitychange", onVisibilityChange)]);
|
|
7817
7889
|
};
|
|
7818
7890
|
return [inBackgroundSince, unsub];
|
|
7819
7891
|
}
|
|
@@ -7993,7 +8065,7 @@ function createRoom(options, config) {
|
|
|
7993
8065
|
}
|
|
7994
8066
|
}
|
|
7995
8067
|
function isStorageWritable() {
|
|
7996
|
-
const scopes = _optionalChain([context, 'access',
|
|
8068
|
+
const scopes = _optionalChain([context, 'access', _172 => _172.dynamicSessionInfoSig, 'access', _173 => _173.get, 'call', _174 => _174(), 'optionalAccess', _175 => _175.scopes]);
|
|
7997
8069
|
return scopes !== void 0 ? canWriteStorage(scopes) : true;
|
|
7998
8070
|
}
|
|
7999
8071
|
const eventHub = {
|
|
@@ -8110,7 +8182,7 @@ function createRoom(options, config) {
|
|
|
8110
8182
|
}
|
|
8111
8183
|
case "experimental-fallback-to-http": {
|
|
8112
8184
|
warn("Message is too large for websockets, so sending over HTTP instead");
|
|
8113
|
-
const nonce = _nullishCoalesce(_optionalChain([context, 'access',
|
|
8185
|
+
const nonce = _nullishCoalesce(_optionalChain([context, 'access', _176 => _176.dynamicSessionInfoSig, 'access', _177 => _177.get, 'call', _178 => _178(), 'optionalAccess', _179 => _179.nonce]), () => ( raise("Session is not authorized to send message over HTTP")));
|
|
8114
8186
|
void httpClient.sendMessages({ roomId, nonce, messages }).then((resp) => {
|
|
8115
8187
|
if (!resp.ok && resp.status === 403) {
|
|
8116
8188
|
managedSocket.reconnect();
|
|
@@ -8161,7 +8233,7 @@ function createRoom(options, config) {
|
|
|
8161
8233
|
} else {
|
|
8162
8234
|
context.root = LiveObject._fromItems(message.items, context.pool);
|
|
8163
8235
|
}
|
|
8164
|
-
const canWrite = _nullishCoalesce(_optionalChain([self, 'access',
|
|
8236
|
+
const canWrite = _nullishCoalesce(_optionalChain([self, 'access', _180 => _180.get, 'call', _181 => _181(), 'optionalAccess', _182 => _182.canWrite]), () => ( true));
|
|
8165
8237
|
const stackSizeBefore = context.undoStack.length;
|
|
8166
8238
|
for (const key in context.initialStorage) {
|
|
8167
8239
|
if (context.root.get(key) === void 0) {
|
|
@@ -8364,7 +8436,7 @@ function createRoom(options, config) {
|
|
|
8364
8436
|
}
|
|
8365
8437
|
context.myPresence.patch(patch);
|
|
8366
8438
|
if (context.activeBatch) {
|
|
8367
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
8439
|
+
if (_optionalChain([options2, 'optionalAccess', _183 => _183.addToHistory])) {
|
|
8368
8440
|
context.activeBatch.reverseOps.pushLeft({
|
|
8369
8441
|
type: "presence",
|
|
8370
8442
|
data: oldValues
|
|
@@ -8373,7 +8445,7 @@ function createRoom(options, config) {
|
|
|
8373
8445
|
context.activeBatch.updates.presence = true;
|
|
8374
8446
|
} else {
|
|
8375
8447
|
flushNowOrSoon();
|
|
8376
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
8448
|
+
if (_optionalChain([options2, 'optionalAccess', _184 => _184.addToHistory])) {
|
|
8377
8449
|
addToUndoStack([{ type: "presence", data: oldValues }]);
|
|
8378
8450
|
}
|
|
8379
8451
|
notify({ presence: true });
|
|
@@ -8570,7 +8642,7 @@ function createRoom(options, config) {
|
|
|
8570
8642
|
if (process.env.NODE_ENV !== "production") {
|
|
8571
8643
|
const traces = /* @__PURE__ */ new Set();
|
|
8572
8644
|
for (const opId of message.opIds) {
|
|
8573
|
-
const trace = _optionalChain([context, 'access',
|
|
8645
|
+
const trace = _optionalChain([context, 'access', _185 => _185.opStackTraces, 'optionalAccess', _186 => _186.get, 'call', _187 => _187(opId)]);
|
|
8574
8646
|
if (trace) {
|
|
8575
8647
|
traces.add(trace);
|
|
8576
8648
|
}
|
|
@@ -8704,7 +8776,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
8704
8776
|
const unacknowledgedOps = new Map(context.unacknowledgedOps);
|
|
8705
8777
|
createOrUpdateRootFromMessage(message);
|
|
8706
8778
|
applyAndSendOps(unacknowledgedOps);
|
|
8707
|
-
_optionalChain([_resolveStoragePromise, 'optionalCall',
|
|
8779
|
+
_optionalChain([_resolveStoragePromise, 'optionalCall', _188 => _188()]);
|
|
8708
8780
|
notifyStorageStatus();
|
|
8709
8781
|
eventHub.storageDidLoad.notify();
|
|
8710
8782
|
}
|
|
@@ -8927,8 +8999,8 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
8927
8999
|
async function getThreads(options2) {
|
|
8928
9000
|
return httpClient.getThreads({
|
|
8929
9001
|
roomId,
|
|
8930
|
-
query: _optionalChain([options2, 'optionalAccess',
|
|
8931
|
-
cursor: _optionalChain([options2, 'optionalAccess',
|
|
9002
|
+
query: _optionalChain([options2, 'optionalAccess', _189 => _189.query]),
|
|
9003
|
+
cursor: _optionalChain([options2, 'optionalAccess', _190 => _190.cursor])
|
|
8932
9004
|
});
|
|
8933
9005
|
}
|
|
8934
9006
|
async function getThread(threadId) {
|
|
@@ -9035,7 +9107,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
9035
9107
|
function getSubscriptionSettings(options2) {
|
|
9036
9108
|
return httpClient.getSubscriptionSettings({
|
|
9037
9109
|
roomId,
|
|
9038
|
-
signal: _optionalChain([options2, 'optionalAccess',
|
|
9110
|
+
signal: _optionalChain([options2, 'optionalAccess', _191 => _191.signal])
|
|
9039
9111
|
});
|
|
9040
9112
|
}
|
|
9041
9113
|
function updateSubscriptionSettings(settings) {
|
|
@@ -9057,7 +9129,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
9057
9129
|
{
|
|
9058
9130
|
[kInternal]: {
|
|
9059
9131
|
get presenceBuffer() {
|
|
9060
|
-
return deepClone(_nullishCoalesce(_optionalChain([context, 'access',
|
|
9132
|
+
return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _192 => _192.buffer, 'access', _193 => _193.presenceUpdates, 'optionalAccess', _194 => _194.data]), () => ( null)));
|
|
9061
9133
|
},
|
|
9062
9134
|
// prettier-ignore
|
|
9063
9135
|
get undoStack() {
|
|
@@ -9072,9 +9144,9 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
9072
9144
|
return context.yjsProvider;
|
|
9073
9145
|
},
|
|
9074
9146
|
setYjsProvider(newProvider) {
|
|
9075
|
-
_optionalChain([context, 'access',
|
|
9147
|
+
_optionalChain([context, 'access', _195 => _195.yjsProvider, 'optionalAccess', _196 => _196.off, 'call', _197 => _197("status", yjsStatusDidChange)]);
|
|
9076
9148
|
context.yjsProvider = newProvider;
|
|
9077
|
-
_optionalChain([newProvider, 'optionalAccess',
|
|
9149
|
+
_optionalChain([newProvider, 'optionalAccess', _198 => _198.on, 'call', _199 => _199("status", yjsStatusDidChange)]);
|
|
9078
9150
|
context.yjsProviderDidChange.notify();
|
|
9079
9151
|
},
|
|
9080
9152
|
yjsProviderDidChange: context.yjsProviderDidChange.observable,
|
|
@@ -9120,7 +9192,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
9120
9192
|
source.dispose();
|
|
9121
9193
|
}
|
|
9122
9194
|
eventHub.roomWillDestroy.notify();
|
|
9123
|
-
_optionalChain([context, 'access',
|
|
9195
|
+
_optionalChain([context, 'access', _200 => _200.yjsProvider, 'optionalAccess', _201 => _201.off, 'call', _202 => _202("status", yjsStatusDidChange)]);
|
|
9124
9196
|
syncSourceForStorage.destroy();
|
|
9125
9197
|
syncSourceForYjs.destroy();
|
|
9126
9198
|
uninstallBgTabSpy();
|
|
@@ -9270,7 +9342,7 @@ function makeClassicSubscribeFn(roomId, events, errorEvents) {
|
|
|
9270
9342
|
}
|
|
9271
9343
|
if (isLiveNode(first)) {
|
|
9272
9344
|
const node = first;
|
|
9273
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
9345
|
+
if (_optionalChain([options, 'optionalAccess', _203 => _203.isDeep])) {
|
|
9274
9346
|
const storageCallback = second;
|
|
9275
9347
|
return subscribeToLiveStructureDeeply(node, storageCallback);
|
|
9276
9348
|
} else {
|
|
@@ -9349,8 +9421,8 @@ function createClient(options) {
|
|
|
9349
9421
|
const userId = token.k === "sec-legacy" /* SECRET_LEGACY */ ? token.id : token.uid;
|
|
9350
9422
|
currentUserId.set(() => userId);
|
|
9351
9423
|
});
|
|
9352
|
-
const fetchPolyfill = _optionalChain([clientOptions, 'access',
|
|
9353
|
-
_optionalChain([globalThis, 'access',
|
|
9424
|
+
const fetchPolyfill = _optionalChain([clientOptions, 'access', _204 => _204.polyfills, 'optionalAccess', _205 => _205.fetch]) || /* istanbul ignore next */
|
|
9425
|
+
_optionalChain([globalThis, 'access', _206 => _206.fetch, 'optionalAccess', _207 => _207.bind, 'call', _208 => _208(globalThis)]);
|
|
9354
9426
|
const httpClient = createApiClient({
|
|
9355
9427
|
baseUrl,
|
|
9356
9428
|
fetchPolyfill,
|
|
@@ -9368,7 +9440,7 @@ function createClient(options) {
|
|
|
9368
9440
|
delegates: {
|
|
9369
9441
|
createSocket: makeCreateSocketDelegateForAi(
|
|
9370
9442
|
baseUrl,
|
|
9371
|
-
_optionalChain([clientOptions, 'access',
|
|
9443
|
+
_optionalChain([clientOptions, 'access', _209 => _209.polyfills, 'optionalAccess', _210 => _210.WebSocket])
|
|
9372
9444
|
),
|
|
9373
9445
|
authenticate: makeAuthDelegateForRoom("default", authManager),
|
|
9374
9446
|
canZombie: () => true
|
|
@@ -9418,7 +9490,7 @@ function createClient(options) {
|
|
|
9418
9490
|
createSocket: makeCreateSocketDelegateForRoom(
|
|
9419
9491
|
roomId,
|
|
9420
9492
|
baseUrl,
|
|
9421
|
-
_optionalChain([clientOptions, 'access',
|
|
9493
|
+
_optionalChain([clientOptions, 'access', _211 => _211.polyfills, 'optionalAccess', _212 => _212.WebSocket])
|
|
9422
9494
|
),
|
|
9423
9495
|
authenticate: makeAuthDelegateForRoom(roomId, authManager)
|
|
9424
9496
|
})),
|
|
@@ -9441,7 +9513,7 @@ function createClient(options) {
|
|
|
9441
9513
|
const shouldConnect = _nullishCoalesce(options2.autoConnect, () => ( true));
|
|
9442
9514
|
if (shouldConnect) {
|
|
9443
9515
|
if (typeof atob === "undefined") {
|
|
9444
|
-
if (_optionalChain([clientOptions, 'access',
|
|
9516
|
+
if (_optionalChain([clientOptions, 'access', _213 => _213.polyfills, 'optionalAccess', _214 => _214.atob]) === void 0) {
|
|
9445
9517
|
throw new Error(
|
|
9446
9518
|
"You need to polyfill atob to use the client in your environment. Please follow the instructions at https://liveblocks.io/docs/errors/liveblocks-client/atob-polyfill"
|
|
9447
9519
|
);
|
|
@@ -9453,7 +9525,7 @@ function createClient(options) {
|
|
|
9453
9525
|
return leaseRoom(newRoomDetails);
|
|
9454
9526
|
}
|
|
9455
9527
|
function getRoom(roomId) {
|
|
9456
|
-
const room = _optionalChain([roomsById, 'access',
|
|
9528
|
+
const room = _optionalChain([roomsById, 'access', _215 => _215.get, 'call', _216 => _216(roomId), 'optionalAccess', _217 => _217.room]);
|
|
9457
9529
|
return room ? room : null;
|
|
9458
9530
|
}
|
|
9459
9531
|
function logout() {
|
|
@@ -9473,7 +9545,7 @@ function createClient(options) {
|
|
|
9473
9545
|
const batchedResolveUsers = new Batch(
|
|
9474
9546
|
async (batchedUserIds) => {
|
|
9475
9547
|
const userIds = batchedUserIds.flat();
|
|
9476
|
-
const users = await _optionalChain([resolveUsers, 'optionalCall',
|
|
9548
|
+
const users = await _optionalChain([resolveUsers, 'optionalCall', _218 => _218({ userIds })]);
|
|
9477
9549
|
warnIfNoResolveUsers();
|
|
9478
9550
|
return _nullishCoalesce(users, () => ( userIds.map(() => void 0)));
|
|
9479
9551
|
},
|
|
@@ -9491,7 +9563,7 @@ function createClient(options) {
|
|
|
9491
9563
|
const batchedResolveRoomsInfo = new Batch(
|
|
9492
9564
|
async (batchedRoomIds) => {
|
|
9493
9565
|
const roomIds = batchedRoomIds.flat();
|
|
9494
|
-
const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall',
|
|
9566
|
+
const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _219 => _219({ roomIds })]);
|
|
9495
9567
|
warnIfNoResolveRoomsInfo();
|
|
9496
9568
|
return _nullishCoalesce(roomsInfo, () => ( roomIds.map(() => void 0)));
|
|
9497
9569
|
},
|
|
@@ -9544,7 +9616,7 @@ function createClient(options) {
|
|
|
9544
9616
|
}
|
|
9545
9617
|
};
|
|
9546
9618
|
const win = typeof window !== "undefined" ? window : void 0;
|
|
9547
|
-
_optionalChain([win, 'optionalAccess',
|
|
9619
|
+
_optionalChain([win, 'optionalAccess', _220 => _220.addEventListener, 'call', _221 => _221("beforeunload", maybePreventClose)]);
|
|
9548
9620
|
}
|
|
9549
9621
|
async function getNotificationSettings(options2) {
|
|
9550
9622
|
const plainSettings = await httpClient.getNotificationSettings(options2);
|
|
@@ -9683,7 +9755,7 @@ var commentBodyElementsTypes = {
|
|
|
9683
9755
|
mention: "inline"
|
|
9684
9756
|
};
|
|
9685
9757
|
function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
|
|
9686
|
-
if (!body || !_optionalChain([body, 'optionalAccess',
|
|
9758
|
+
if (!body || !_optionalChain([body, 'optionalAccess', _222 => _222.content])) {
|
|
9687
9759
|
return;
|
|
9688
9760
|
}
|
|
9689
9761
|
const element = typeof elementOrVisitor === "string" ? elementOrVisitor : void 0;
|
|
@@ -9693,13 +9765,13 @@ function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
|
|
|
9693
9765
|
for (const block of body.content) {
|
|
9694
9766
|
if (type === "all" || type === "block") {
|
|
9695
9767
|
if (guard(block)) {
|
|
9696
|
-
_optionalChain([visitor, 'optionalCall',
|
|
9768
|
+
_optionalChain([visitor, 'optionalCall', _223 => _223(block)]);
|
|
9697
9769
|
}
|
|
9698
9770
|
}
|
|
9699
9771
|
if (type === "all" || type === "inline") {
|
|
9700
9772
|
for (const inline of block.children) {
|
|
9701
9773
|
if (guard(inline)) {
|
|
9702
|
-
_optionalChain([visitor, 'optionalCall',
|
|
9774
|
+
_optionalChain([visitor, 'optionalCall', _224 => _224(inline)]);
|
|
9703
9775
|
}
|
|
9704
9776
|
}
|
|
9705
9777
|
}
|
|
@@ -9724,7 +9796,7 @@ async function resolveUsersInCommentBody(body, resolveUsers) {
|
|
|
9724
9796
|
userIds
|
|
9725
9797
|
});
|
|
9726
9798
|
for (const [index, userId] of userIds.entries()) {
|
|
9727
|
-
const user = _optionalChain([users, 'optionalAccess',
|
|
9799
|
+
const user = _optionalChain([users, 'optionalAccess', _225 => _225[index]]);
|
|
9728
9800
|
if (user) {
|
|
9729
9801
|
resolvedUsers.set(userId, user);
|
|
9730
9802
|
}
|
|
@@ -9851,7 +9923,7 @@ var stringifyCommentBodyPlainElements = {
|
|
|
9851
9923
|
text: ({ element }) => element.text,
|
|
9852
9924
|
link: ({ element }) => _nullishCoalesce(element.text, () => ( element.url)),
|
|
9853
9925
|
mention: ({ element, user }) => {
|
|
9854
|
-
return `@${_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
9926
|
+
return `@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _226 => _226.name]), () => ( element.id))}`;
|
|
9855
9927
|
}
|
|
9856
9928
|
};
|
|
9857
9929
|
var stringifyCommentBodyHtmlElements = {
|
|
@@ -9881,7 +9953,7 @@ var stringifyCommentBodyHtmlElements = {
|
|
|
9881
9953
|
return html`<a href="${href}" target="_blank" rel="noopener noreferrer">${element.text ? html`${element.text}` : element.url}</a>`;
|
|
9882
9954
|
},
|
|
9883
9955
|
mention: ({ element, user }) => {
|
|
9884
|
-
return html`<span data-mention>@${_optionalChain([user, 'optionalAccess',
|
|
9956
|
+
return html`<span data-mention>@${_optionalChain([user, 'optionalAccess', _227 => _227.name]) ? html`${_optionalChain([user, 'optionalAccess', _228 => _228.name])}` : element.id}</span>`;
|
|
9885
9957
|
}
|
|
9886
9958
|
};
|
|
9887
9959
|
var stringifyCommentBodyMarkdownElements = {
|
|
@@ -9911,19 +9983,19 @@ var stringifyCommentBodyMarkdownElements = {
|
|
|
9911
9983
|
return markdown`[${_nullishCoalesce(element.text, () => ( element.url))}](${href})`;
|
|
9912
9984
|
},
|
|
9913
9985
|
mention: ({ element, user }) => {
|
|
9914
|
-
return markdown`@${_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
9986
|
+
return markdown`@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _229 => _229.name]), () => ( element.id))}`;
|
|
9915
9987
|
}
|
|
9916
9988
|
};
|
|
9917
9989
|
async function stringifyCommentBody(body, options) {
|
|
9918
|
-
const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
9919
|
-
const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
9990
|
+
const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _230 => _230.format]), () => ( "plain"));
|
|
9991
|
+
const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _231 => _231.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
|
|
9920
9992
|
const elements = {
|
|
9921
9993
|
...format === "html" ? stringifyCommentBodyHtmlElements : format === "markdown" ? stringifyCommentBodyMarkdownElements : stringifyCommentBodyPlainElements,
|
|
9922
|
-
..._optionalChain([options, 'optionalAccess',
|
|
9994
|
+
..._optionalChain([options, 'optionalAccess', _232 => _232.elements])
|
|
9923
9995
|
};
|
|
9924
9996
|
const resolvedUsers = await resolveUsersInCommentBody(
|
|
9925
9997
|
body,
|
|
9926
|
-
_optionalChain([options, 'optionalAccess',
|
|
9998
|
+
_optionalChain([options, 'optionalAccess', _233 => _233.resolveUsers])
|
|
9927
9999
|
);
|
|
9928
10000
|
const blocks = body.content.flatMap((block, blockIndex) => {
|
|
9929
10001
|
switch (block.type) {
|
|
@@ -10214,12 +10286,12 @@ function legacy_patchImmutableNode(state, path, update) {
|
|
|
10214
10286
|
}
|
|
10215
10287
|
const newState = Object.assign({}, state);
|
|
10216
10288
|
for (const key in update.updates) {
|
|
10217
|
-
if (_optionalChain([update, 'access',
|
|
10289
|
+
if (_optionalChain([update, 'access', _234 => _234.updates, 'access', _235 => _235[key], 'optionalAccess', _236 => _236.type]) === "update") {
|
|
10218
10290
|
const val = update.node.get(key);
|
|
10219
10291
|
if (val !== void 0) {
|
|
10220
10292
|
newState[key] = lsonToJson(val);
|
|
10221
10293
|
}
|
|
10222
|
-
} else if (_optionalChain([update, 'access',
|
|
10294
|
+
} else if (_optionalChain([update, 'access', _237 => _237.updates, 'access', _238 => _238[key], 'optionalAccess', _239 => _239.type]) === "delete") {
|
|
10223
10295
|
delete newState[key];
|
|
10224
10296
|
}
|
|
10225
10297
|
}
|
|
@@ -10280,12 +10352,12 @@ function legacy_patchImmutableNode(state, path, update) {
|
|
|
10280
10352
|
}
|
|
10281
10353
|
const newState = Object.assign({}, state);
|
|
10282
10354
|
for (const key in update.updates) {
|
|
10283
|
-
if (_optionalChain([update, 'access',
|
|
10355
|
+
if (_optionalChain([update, 'access', _240 => _240.updates, 'access', _241 => _241[key], 'optionalAccess', _242 => _242.type]) === "update") {
|
|
10284
10356
|
const value = update.node.get(key);
|
|
10285
10357
|
if (value !== void 0) {
|
|
10286
10358
|
newState[key] = lsonToJson(value);
|
|
10287
10359
|
}
|
|
10288
|
-
} else if (_optionalChain([update, 'access',
|
|
10360
|
+
} else if (_optionalChain([update, 'access', _243 => _243.updates, 'access', _244 => _244[key], 'optionalAccess', _245 => _245.type]) === "delete") {
|
|
10289
10361
|
delete newState[key];
|
|
10290
10362
|
}
|
|
10291
10363
|
}
|
|
@@ -10365,9 +10437,9 @@ function makePoller(callback, intervalMs, options) {
|
|
|
10365
10437
|
const startTime = performance.now();
|
|
10366
10438
|
const doc = typeof document !== "undefined" ? document : void 0;
|
|
10367
10439
|
const win = typeof window !== "undefined" ? window : void 0;
|
|
10368
|
-
const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
10440
|
+
const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _246 => _246.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
|
|
10369
10441
|
const context = {
|
|
10370
|
-
inForeground: _optionalChain([doc, 'optionalAccess',
|
|
10442
|
+
inForeground: _optionalChain([doc, 'optionalAccess', _247 => _247.visibilityState]) !== "hidden",
|
|
10371
10443
|
lastSuccessfulPollAt: startTime,
|
|
10372
10444
|
count: 0,
|
|
10373
10445
|
backoff: 0
|
|
@@ -10448,11 +10520,11 @@ function makePoller(callback, intervalMs, options) {
|
|
|
10448
10520
|
pollNowIfStale();
|
|
10449
10521
|
}
|
|
10450
10522
|
function onVisibilityChange() {
|
|
10451
|
-
setInForeground(_optionalChain([doc, 'optionalAccess',
|
|
10523
|
+
setInForeground(_optionalChain([doc, 'optionalAccess', _248 => _248.visibilityState]) !== "hidden");
|
|
10452
10524
|
}
|
|
10453
|
-
_optionalChain([doc, 'optionalAccess',
|
|
10454
|
-
_optionalChain([win, 'optionalAccess',
|
|
10455
|
-
_optionalChain([win, 'optionalAccess',
|
|
10525
|
+
_optionalChain([doc, 'optionalAccess', _249 => _249.addEventListener, 'call', _250 => _250("visibilitychange", onVisibilityChange)]);
|
|
10526
|
+
_optionalChain([win, 'optionalAccess', _251 => _251.addEventListener, 'call', _252 => _252("online", onVisibilityChange)]);
|
|
10527
|
+
_optionalChain([win, 'optionalAccess', _253 => _253.addEventListener, 'call', _254 => _254("focus", pollNowIfStale)]);
|
|
10456
10528
|
fsm.start();
|
|
10457
10529
|
return {
|
|
10458
10530
|
inc,
|
|
@@ -10583,5 +10655,6 @@ var NotificationsApiError = HttpError;
|
|
|
10583
10655
|
|
|
10584
10656
|
|
|
10585
10657
|
|
|
10586
|
-
|
|
10658
|
+
|
|
10659
|
+
exports.ClientMsgCode = ClientMsgCode; exports.CommentsApiError = CommentsApiError; exports.CrdtType = CrdtType; exports.DefaultMap = DefaultMap; exports.Deque = Deque; exports.DerivedSignal = DerivedSignal; exports.HttpError = HttpError; exports.LiveList = LiveList; exports.LiveMap = LiveMap; exports.LiveObject = LiveObject; exports.LiveblocksError = LiveblocksError; exports.MutableSignal = MutableSignal; exports.NotificationsApiError = NotificationsApiError; exports.OpCode = OpCode; exports.Permission = Permission; exports.Promise_withResolvers = Promise_withResolvers; exports.ServerMsgCode = ServerMsgCode; exports.Signal = Signal; exports.SortedList = SortedList; exports.TextEditorType = TextEditorType; exports.WebsocketCloseCodes = WebsocketCloseCodes; exports.ackOp = ackOp; exports.asPos = asPos; exports.assert = assert; exports.assertNever = assertNever; exports.autoRetry = autoRetry; exports.b64decode = b64decode; exports.batch = batch; exports.checkBounds = checkBounds; exports.chunk = chunk; exports.cloneLson = cloneLson; exports.compactObject = compactObject; exports.console = fancy_console_exports; exports.convertToCommentData = convertToCommentData; exports.convertToCommentUserReaction = convertToCommentUserReaction; exports.convertToInboxNotificationData = convertToInboxNotificationData; exports.convertToSubscriptionData = convertToSubscriptionData; exports.convertToThreadData = convertToThreadData; exports.convertToUserSubscriptionData = convertToUserSubscriptionData; exports.createClient = createClient; exports.createCommentAttachmentId = createCommentAttachmentId; exports.createCommentId = createCommentId; exports.createInboxNotificationId = createInboxNotificationId; exports.createManagedPool = createManagedPool; exports.createNotificationSettings = createNotificationSettings; exports.createThreadId = createThreadId; exports.defineAiTool = defineAiTool; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.detectDupes = detectDupes; exports.entries = entries; exports.errorIf = errorIf; exports.freeze = freeze; exports.generateCommentUrl = generateCommentUrl; exports.getMentionedIdsFromCommentBody = getMentionedIdsFromCommentBody; exports.getSubscriptionKey = getSubscriptionKey; exports.html = html; exports.htmlSafe = htmlSafe; exports.isChildCrdt = isChildCrdt; exports.isCommentBodyLink = isCommentBodyLink; exports.isCommentBodyMention = isCommentBodyMention; exports.isCommentBodyText = isCommentBodyText; exports.isJsonArray = isJsonArray; exports.isJsonObject = isJsonObject; exports.isJsonScalar = isJsonScalar; exports.isLiveNode = isLiveNode; exports.isNotificationChannelEnabled = isNotificationChannelEnabled; exports.isPlainObject = isPlainObject; exports.isRootCrdt = isRootCrdt; exports.isStartsWithOperator = isStartsWithOperator; exports.kInternal = kInternal; exports.keys = keys; exports.legacy_patchImmutableObject = legacy_patchImmutableObject; exports.lsonToJson = lsonToJson; exports.makeAbortController = makeAbortController; exports.makeEventSource = makeEventSource; exports.makePoller = makePoller; exports.makePosition = makePosition; exports.mapValues = mapValues; exports.memoizeOnSuccess = memoizeOnSuccess; exports.nanoid = nanoid; exports.nn = nn; exports.objectToQuery = objectToQuery; exports.patchLiveObjectKey = patchLiveObjectKey; exports.patchNotificationSettings = patchNotificationSettings; exports.raise = raise; exports.resolveUsersInCommentBody = resolveUsersInCommentBody; exports.shallow = shallow; exports.shallow2 = shallow2; exports.stableStringify = stableStringify; exports.stringifyCommentBody = stringifyCommentBody; exports.throwUsageError = throwUsageError; exports.toAbsoluteUrl = toAbsoluteUrl; exports.toPlainLson = toPlainLson; exports.tryParseJson = tryParseJson; exports.url = url; exports.urljoin = urljoin; exports.wait = wait; exports.withTimeout = withTimeout;
|
|
10587
10660
|
//# sourceMappingURL=index.cjs.map
|