@adhdev/daemon-standalone 0.9.39 → 0.9.40
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 +73 -65
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/{index-B_GRvXdo.js → index-D1GQ1ulL.js} +20 -20
- package/public/index.html +1 -1
package/dist/index.js
CHANGED
|
@@ -29662,9 +29662,7 @@ var require_dist2 = __commonJS({
|
|
|
29662
29662
|
};
|
|
29663
29663
|
});
|
|
29664
29664
|
}
|
|
29665
|
-
function chooseMoreComparableCliMessage(left, right) {
|
|
29666
|
-
const leftComparable = normalizeComparableMessageContent(left.content || "");
|
|
29667
|
-
const rightComparable = normalizeComparableMessageContent(right.content || "");
|
|
29665
|
+
function chooseMoreComparableCliMessage(left, right, leftComparable = normalizeComparableMessageContent(left.content || ""), rightComparable = normalizeComparableMessageContent(right.content || "")) {
|
|
29668
29666
|
if (leftComparable && leftComparable === rightComparable) {
|
|
29669
29667
|
const leftNewlines = String(left.content || "").split(/\r\n|\n|\r/g).length - 1;
|
|
29670
29668
|
const rightNewlines = String(right.content || "").split(/\r\n|\n|\r/g).length - 1;
|
|
@@ -29679,24 +29677,32 @@ var require_dist2 = __commonJS({
|
|
|
29679
29677
|
...message,
|
|
29680
29678
|
content: typeof message.content === "string" ? message.content : String(message.content || "")
|
|
29681
29679
|
};
|
|
29680
|
+
const currentComparable = normalizeComparableMessageContent(current.content || "");
|
|
29682
29681
|
const previous = deduped[deduped.length - 1];
|
|
29683
29682
|
if (!previous) {
|
|
29684
|
-
deduped.push(current);
|
|
29683
|
+
deduped.push({ message: current, comparable: currentComparable });
|
|
29685
29684
|
continue;
|
|
29686
29685
|
}
|
|
29687
|
-
const
|
|
29688
|
-
const
|
|
29689
|
-
const
|
|
29690
|
-
const
|
|
29691
|
-
const sameSender = (previous.senderName || "") === (current.senderName || "");
|
|
29692
|
-
const comparableMatch = previousComparable && previousComparable === currentComparable;
|
|
29686
|
+
const sameRole = previous.message.role === current.role;
|
|
29687
|
+
const sameKind = (previous.message.kind || "standard") === (current.kind || "standard");
|
|
29688
|
+
const sameSender = (previous.message.senderName || "") === (current.senderName || "");
|
|
29689
|
+
const comparableMatch = previous.comparable && previous.comparable === currentComparable;
|
|
29693
29690
|
if (sameRole && sameKind && sameSender && comparableMatch) {
|
|
29694
|
-
|
|
29691
|
+
const selected = chooseMoreComparableCliMessage(
|
|
29692
|
+
previous.message,
|
|
29693
|
+
current,
|
|
29694
|
+
previous.comparable,
|
|
29695
|
+
currentComparable
|
|
29696
|
+
);
|
|
29697
|
+
deduped[deduped.length - 1] = {
|
|
29698
|
+
message: selected,
|
|
29699
|
+
comparable: selected === current ? currentComparable : previous.comparable
|
|
29700
|
+
};
|
|
29695
29701
|
continue;
|
|
29696
29702
|
}
|
|
29697
|
-
deduped.push(current);
|
|
29703
|
+
deduped.push({ message: current, comparable: currentComparable });
|
|
29698
29704
|
}
|
|
29699
|
-
return deduped;
|
|
29705
|
+
return deduped.map((entry) => entry.message);
|
|
29700
29706
|
}
|
|
29701
29707
|
function normalizeCliParsedMessages(parsedMessages, options) {
|
|
29702
29708
|
return dedupeConsecutiveComparableCliMessages(hydrateCliParsedMessages(parsedMessages, options).map((message) => ({
|
|
@@ -38406,68 +38412,66 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38406
38412
|
const messages = Array.isArray(payload.messages) ? payload.messages : [];
|
|
38407
38413
|
return normalizeChatMessages(messages);
|
|
38408
38414
|
}
|
|
38409
|
-
function
|
|
38410
|
-
|
|
38411
|
-
const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
|
|
38412
|
-
const kind = typeof message.kind === "string" ? message.kind.trim().toLowerCase() : "standard";
|
|
38413
|
-
const senderName = typeof message.senderName === "string" ? message.senderName.trim().toLowerCase() : "";
|
|
38414
|
-
const content = flattenContent(message.content || "").replace(/\s+/g, " ").trim();
|
|
38415
|
-
return `${role}:${kind}:${senderName}:${content}`;
|
|
38415
|
+
function normalizeReadChatReplayTextContent(content) {
|
|
38416
|
+
return flattenContent(content || "").replace(/\s+/g, " ").trim();
|
|
38416
38417
|
}
|
|
38417
|
-
function
|
|
38418
|
-
if (!message) return
|
|
38419
|
-
const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
|
|
38420
|
-
return role === "assistant" || role === "system";
|
|
38421
|
-
}
|
|
38422
|
-
function normalizeReadChatReplayText(message) {
|
|
38423
|
-
return flattenContent(message?.content || "").replace(/\s+/g, " ").trim();
|
|
38424
|
-
}
|
|
38425
|
-
function isStableReadChatAssistantAnswer(message) {
|
|
38426
|
-
if (!message) return false;
|
|
38418
|
+
function getReadChatReplayCollapseInfo(message) {
|
|
38419
|
+
if (!message) return null;
|
|
38427
38420
|
const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
|
|
38428
38421
|
const kind = typeof message.kind === "string" ? message.kind.trim().toLowerCase() : "standard";
|
|
38429
|
-
|
|
38430
|
-
|
|
38431
|
-
|
|
38432
|
-
|
|
38433
|
-
|
|
38422
|
+
const senderName = typeof message.senderName === "string" ? message.senderName.trim().toLowerCase() : "";
|
|
38423
|
+
const collapsible = role === "assistant" || role === "system";
|
|
38424
|
+
if (!collapsible) return { role, kind, senderName, content: "", signature: "", collapsible };
|
|
38425
|
+
const content = normalizeReadChatReplayTextContent(message.content);
|
|
38426
|
+
return {
|
|
38427
|
+
role,
|
|
38428
|
+
kind,
|
|
38429
|
+
senderName,
|
|
38430
|
+
content,
|
|
38431
|
+
signature: `${role}:${kind}:${senderName}:${content}`,
|
|
38432
|
+
collapsible
|
|
38433
|
+
};
|
|
38434
|
+
}
|
|
38435
|
+
function isStableReadChatAssistantAnswerInfo(info) {
|
|
38436
|
+
if (!info) return false;
|
|
38437
|
+
if (info.role !== "assistant") return false;
|
|
38438
|
+
if (info.kind && info.kind !== "standard") return false;
|
|
38439
|
+
if (info.content.length < 160) return false;
|
|
38440
|
+
if (/^(bash|shell|terminal) command\b/i.test(info.content)) return false;
|
|
38434
38441
|
return true;
|
|
38435
38442
|
}
|
|
38436
|
-
function
|
|
38437
|
-
if (!
|
|
38438
|
-
|
|
38439
|
-
|
|
38440
|
-
|
|
38441
|
-
if (kind && kind !== "standard") return false;
|
|
38442
|
-
const content = normalizeReadChatReplayText(message);
|
|
38443
|
-
const stableContent = normalizeReadChatReplayText(stableAnswer);
|
|
38443
|
+
function isReplayedAssistantAnswerAfterStableAnswerInfo(info, stableContent) {
|
|
38444
|
+
if (!info || !stableContent) return false;
|
|
38445
|
+
if (info.role !== "assistant") return false;
|
|
38446
|
+
if (info.kind && info.kind !== "standard") return false;
|
|
38447
|
+
const content = info.content;
|
|
38444
38448
|
if (content.length < 80 || stableContent.length < 80) return false;
|
|
38445
38449
|
return content === stableContent || content.startsWith(stableContent) || stableContent.startsWith(content);
|
|
38446
38450
|
}
|
|
38447
38451
|
function collapseReplayDuplicatesFromReadChat(messages) {
|
|
38448
38452
|
const collapsed = [];
|
|
38449
38453
|
const replaySignaturesInCurrentTurn = /* @__PURE__ */ new Set();
|
|
38450
|
-
let
|
|
38454
|
+
let stableAssistantAnswerContentInCurrentTurn = "";
|
|
38455
|
+
let previousReplaySignature = "";
|
|
38451
38456
|
for (const message of messages) {
|
|
38452
|
-
const
|
|
38453
|
-
if (role === "user") {
|
|
38457
|
+
const info = getReadChatReplayCollapseInfo(message);
|
|
38458
|
+
if (info?.role === "user") {
|
|
38454
38459
|
replaySignaturesInCurrentTurn.clear();
|
|
38455
|
-
|
|
38460
|
+
stableAssistantAnswerContentInCurrentTurn = "";
|
|
38461
|
+
previousReplaySignature = "";
|
|
38456
38462
|
}
|
|
38457
|
-
|
|
38458
|
-
|
|
38459
|
-
|
|
38460
|
-
|
|
38461
|
-
if (previousSignature === signature) continue;
|
|
38462
|
-
if (replaySignaturesInCurrentTurn.has(signature)) continue;
|
|
38463
|
-
if (isReplayedAssistantAnswerAfterStableAnswer(message, stableAssistantAnswerInCurrentTurn)) continue;
|
|
38463
|
+
if (info?.collapsible && info.signature) {
|
|
38464
|
+
if (previousReplaySignature === info.signature) continue;
|
|
38465
|
+
if (replaySignaturesInCurrentTurn.has(info.signature)) continue;
|
|
38466
|
+
if (isReplayedAssistantAnswerAfterStableAnswerInfo(info, stableAssistantAnswerContentInCurrentTurn)) continue;
|
|
38464
38467
|
}
|
|
38465
38468
|
collapsed.push(message);
|
|
38466
|
-
|
|
38467
|
-
|
|
38469
|
+
previousReplaySignature = info?.collapsible ? info.signature : "";
|
|
38470
|
+
if (info?.collapsible && info.signature) {
|
|
38471
|
+
replaySignaturesInCurrentTurn.add(info.signature);
|
|
38468
38472
|
}
|
|
38469
|
-
if (
|
|
38470
|
-
|
|
38473
|
+
if (isStableReadChatAssistantAnswerInfo(info)) {
|
|
38474
|
+
stableAssistantAnswerContentInCurrentTurn = info?.content || "";
|
|
38471
38475
|
}
|
|
38472
38476
|
}
|
|
38473
38477
|
return collapsed;
|
|
@@ -38547,13 +38551,17 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38547
38551
|
};
|
|
38548
38552
|
}
|
|
38549
38553
|
if (cursor.tailLimit > 0 && knownSignature === lastMessageSignature) {
|
|
38550
|
-
|
|
38551
|
-
|
|
38552
|
-
|
|
38553
|
-
|
|
38554
|
-
|
|
38555
|
-
|
|
38556
|
-
|
|
38554
|
+
const requestedTailCount = Math.min(totalMessages, cursor.tailLimit);
|
|
38555
|
+
if (knownMessageCount >= requestedTailCount) {
|
|
38556
|
+
return {
|
|
38557
|
+
syncMode: "noop",
|
|
38558
|
+
replaceFrom: totalMessages,
|
|
38559
|
+
messages: [],
|
|
38560
|
+
totalMessages,
|
|
38561
|
+
lastMessageSignature
|
|
38562
|
+
};
|
|
38563
|
+
}
|
|
38564
|
+
return buildBoundedTailSync(messages, cursor);
|
|
38557
38565
|
}
|
|
38558
38566
|
if (knownMessageCount < totalMessages) {
|
|
38559
38567
|
const anchorSignature = getChatMessageSignature(messages[knownMessageCount - 1]);
|