@adhdev/daemon-core 0.9.37 → 0.9.38
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.js
CHANGED
|
@@ -13290,17 +13290,24 @@ function buildPersistableCliHistorySignature(message) {
|
|
|
13290
13290
|
normalizePersistableCliHistoryContent(message.content)
|
|
13291
13291
|
].join("|");
|
|
13292
13292
|
}
|
|
13293
|
+
function hasSamePersistableCliHistoryIdentity(a, b) {
|
|
13294
|
+
return String(a?.role || "") === String(b?.role || "") && String(a?.kind || "") === String(b?.kind || "") && String(a?.senderName || "") === String(b?.senderName || "") && String(a?.content || "") === String(b?.content || "");
|
|
13295
|
+
}
|
|
13293
13296
|
function buildIncrementalHistoryAppendMessages(previousMessages, currentMessages) {
|
|
13294
13297
|
if (!Array.isArray(currentMessages) || currentMessages.length === 0) return [];
|
|
13295
13298
|
if (!Array.isArray(previousMessages) || previousMessages.length === 0) return currentMessages;
|
|
13296
|
-
const
|
|
13297
|
-
const currentSignatures = currentMessages.map(buildPersistableCliHistorySignature);
|
|
13299
|
+
const comparableLength = Math.min(previousMessages.length, currentMessages.length);
|
|
13298
13300
|
let sharedPrefixLength = 0;
|
|
13299
|
-
while (sharedPrefixLength <
|
|
13301
|
+
while (sharedPrefixLength < comparableLength && hasSamePersistableCliHistoryIdentity(previousMessages[sharedPrefixLength], currentMessages[sharedPrefixLength])) {
|
|
13302
|
+
sharedPrefixLength += 1;
|
|
13303
|
+
}
|
|
13304
|
+
if (sharedPrefixLength === currentMessages.length) return [];
|
|
13305
|
+
if (sharedPrefixLength === previousMessages.length) return currentMessages.slice(sharedPrefixLength);
|
|
13306
|
+
while (sharedPrefixLength < comparableLength && buildPersistableCliHistorySignature(previousMessages[sharedPrefixLength]) === buildPersistableCliHistorySignature(currentMessages[sharedPrefixLength])) {
|
|
13300
13307
|
sharedPrefixLength += 1;
|
|
13301
13308
|
}
|
|
13302
|
-
if (sharedPrefixLength ===
|
|
13303
|
-
if (sharedPrefixLength ===
|
|
13309
|
+
if (sharedPrefixLength === currentMessages.length) return [];
|
|
13310
|
+
if (sharedPrefixLength === previousMessages.length) return currentMessages.slice(sharedPrefixLength);
|
|
13304
13311
|
return currentMessages;
|
|
13305
13312
|
}
|
|
13306
13313
|
var CachedDatabaseSync = null;
|
|
@@ -13546,13 +13553,15 @@ var CliProviderInstance = class {
|
|
|
13546
13553
|
}));
|
|
13547
13554
|
if (!canonicalBackedHistory && !shouldSkipReplayPersist && normalizedMessagesToSave.length > 0) {
|
|
13548
13555
|
const incrementalMessages = buildIncrementalHistoryAppendMessages(this.lastPersistedHistoryMessages, normalizedMessagesToSave);
|
|
13549
|
-
|
|
13550
|
-
this.
|
|
13551
|
-
|
|
13552
|
-
|
|
13553
|
-
|
|
13554
|
-
|
|
13555
|
-
|
|
13556
|
+
if (incrementalMessages.length > 0) {
|
|
13557
|
+
this.historyWriter.appendNewMessages(
|
|
13558
|
+
this.type,
|
|
13559
|
+
incrementalMessages,
|
|
13560
|
+
parsedStatus?.title || dirName,
|
|
13561
|
+
this.instanceId,
|
|
13562
|
+
this.providerSessionId
|
|
13563
|
+
);
|
|
13564
|
+
}
|
|
13556
13565
|
}
|
|
13557
13566
|
if (!canonicalBackedHistory) {
|
|
13558
13567
|
this.lastPersistedHistoryMessages = normalizedMessagesToSave;
|