@usabledev/usable-chat 1.227.0 → 1.228.0
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/cli.js +10 -7
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -52971,7 +52971,7 @@ var init_model_registry = __esm({
|
|
|
52971
52971
|
var version2;
|
|
52972
52972
|
var init_package = __esm({
|
|
52973
52973
|
"package.json"() {
|
|
52974
|
-
version2 = "1.
|
|
52974
|
+
version2 = "1.228.0";
|
|
52975
52975
|
}
|
|
52976
52976
|
});
|
|
52977
52977
|
|
|
@@ -539879,9 +539879,9 @@ function validateNextSnapshot(raw, conversationId) {
|
|
|
539879
539879
|
const snapshot2 = nextSnapshotSchema.parse(raw);
|
|
539880
539880
|
if (snapshot2.conversationId !== conversationId)
|
|
539881
539881
|
throw new Error("Next snapshot conversation mismatch");
|
|
539882
|
-
if (snapshot2.nextAfter !== void 0
|
|
539882
|
+
if (snapshot2.nextAfter !== void 0)
|
|
539883
539883
|
throw new Error("Next snapshot is incomplete. Reconnect to synchronize.");
|
|
539884
|
-
let previous = 0;
|
|
539884
|
+
let previous = snapshot2.startAfter ?? 0;
|
|
539885
539885
|
for (const event of snapshot2.events) {
|
|
539886
539886
|
if (event.conversationId !== conversationId || event.sequence !== previous + 1) {
|
|
539887
539887
|
throw new Error("Next snapshot is incomplete. Reconnect to synchronize.");
|
|
@@ -539917,7 +539917,8 @@ async function completeNextAdmission(initial, fetchPage) {
|
|
|
539917
539917
|
}
|
|
539918
539918
|
const revision = initial.snapshot.revision;
|
|
539919
539919
|
const events = [];
|
|
539920
|
-
|
|
539920
|
+
const startAfter = initial.snapshot.startAfter ?? 0;
|
|
539921
|
+
let after = startAfter;
|
|
539921
539922
|
let size2 = 0;
|
|
539922
539923
|
let page = initial;
|
|
539923
539924
|
for (let pages = 0; pages < 200; pages += 1) {
|
|
@@ -539936,7 +539937,7 @@ async function completeNextAdmission(initial, fetchPage) {
|
|
|
539936
539937
|
if (snapshot2.nextAfter === void 0) {
|
|
539937
539938
|
const full = {
|
|
539938
539939
|
...initial,
|
|
539939
|
-
snapshot: { ...initial.snapshot, events, startAfter
|
|
539940
|
+
snapshot: { ...initial.snapshot, events, startAfter, nextAfter: void 0 }
|
|
539940
539941
|
};
|
|
539941
539942
|
validateNextSnapshot(full.snapshot, initial.conversationId);
|
|
539942
539943
|
return full;
|
|
@@ -539999,7 +540000,8 @@ var init_protocol3 = __esm({
|
|
|
539999
540000
|
expiresAt: external_exports.number().finite().positive(),
|
|
540000
540001
|
snapshot: nextSnapshotSchema,
|
|
540001
540002
|
cacheScope: nextCacheScopeSchema.optional(),
|
|
540002
|
-
historyReset: nextHistoryResetSchema.optional()
|
|
540003
|
+
historyReset: nextHistoryResetSchema.optional(),
|
|
540004
|
+
contextAction: external_exports.literal("compact").optional()
|
|
540003
540005
|
});
|
|
540004
540006
|
}
|
|
540005
540007
|
});
|
|
@@ -540011,7 +540013,7 @@ function createNextEventStream(options2) {
|
|
|
540011
540013
|
let socket = null;
|
|
540012
540014
|
let stopped = false;
|
|
540013
540015
|
let readerClosed = false;
|
|
540014
|
-
let seen = 0;
|
|
540016
|
+
let seen = initial.snapshot.startAfter ?? 0;
|
|
540015
540017
|
let retryAt = 0;
|
|
540016
540018
|
let failures = 0;
|
|
540017
540019
|
let retryTimer;
|
|
@@ -540093,6 +540095,7 @@ data: ${JSON.stringify(event)}
|
|
|
540093
540095
|
const snapshot2 = validateNextSnapshot(raw, initial.conversationId);
|
|
540094
540096
|
if (snapshot2.placement !== initial.snapshot.placement) throw new Error("Next placement changed");
|
|
540095
540097
|
if (snapshot2.revision < seen) return;
|
|
540098
|
+
if ((snapshot2.startAfter ?? 0) > seen) throw new Error("Next event gap. Reconnect to synchronize.");
|
|
540096
540099
|
for (const event of snapshot2.events) {
|
|
540097
540100
|
if (event.type === "history-reset") {
|
|
540098
540101
|
for (const id of nextHistoryResetSchema.parse(event.data).removedMessageIds) removedMessageIds.add(id);
|