acp-kernel 0.0.55-pr.208.59 → 0.0.55-pr.209.60

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
@@ -1700,50 +1700,47 @@ function buildCompressibleRanges(messages, state, config, protectedZoneRefs, cou
1700
1700
  const compressibleMsgs = [];
1701
1701
  const protectedMsgs = [];
1702
1702
  const protectedCallIds = collectProtectedToolCallIds(messages, config);
1703
- let pendingGapC = false;
1704
- let pendingGapP = false;
1703
+ let skipSinceCompressible = false;
1704
+ let skipSinceProtected = false;
1705
1705
  for (const msg of messages) {
1706
1706
  const ref = state.messageRefs.byRaw[msg.id];
1707
+ if (!ref || ref === "BLOCKED") continue;
1707
1708
  if (isSyntheticOrPruned(msg, state)) {
1708
- if (ref && ref !== "BLOCKED") {
1709
- pendingGapC = true;
1710
- pendingGapP = true;
1711
- }
1709
+ skipSinceCompressible = true;
1710
+ skipSinceProtected = true;
1712
1711
  continue;
1713
1712
  }
1714
- if (!ref || ref === "BLOCKED") continue;
1715
1713
  if (isMessageProtectedWithPairing(msg, config, protectedCallIds)) {
1716
1714
  protectedMsgs.push({
1717
1715
  ref,
1718
- gapBefore: pendingGapP,
1716
+ gapBefore: skipSinceProtected,
1719
1717
  tokens: countTokens(msg.text ?? ""),
1720
1718
  tools: msg.toolName ? [msg.toolName] : []
1721
1719
  });
1722
- pendingGapC = true;
1723
- pendingGapP = false;
1720
+ skipSinceProtected = false;
1721
+ skipSinceCompressible = true;
1724
1722
  continue;
1725
1723
  }
1726
1724
  if (protectedZoneRefs?.has(ref)) {
1727
- pendingGapC = true;
1728
- pendingGapP = true;
1725
+ skipSinceCompressible = true;
1726
+ skipSinceProtected = true;
1729
1727
  continue;
1730
1728
  }
1731
1729
  compressibleMsgs.push({
1732
1730
  ref,
1733
- gapBefore: pendingGapC,
1731
+ gapBefore: skipSinceCompressible,
1734
1732
  tokens: countTokens(msg.text ?? ""),
1735
1733
  chars: (msg.text ?? "").length,
1736
1734
  isTool: isToolMessage(msg),
1737
1735
  isUser: msg.role === "user"
1738
1736
  });
1739
- pendingGapC = false;
1740
- pendingGapP = true;
1737
+ skipSinceCompressible = false;
1738
+ skipSinceProtected = true;
1741
1739
  }
1742
1740
  const compressible = [];
1743
1741
  let cur = null;
1744
1742
  for (const info of compressibleMsgs) {
1745
- const hasGap = info.gapBefore;
1746
- if (cur && (info.isUser && cur.count >= 3 || hasGap)) {
1743
+ if (cur && (info.isUser && cur.count >= 3 || info.gapBefore)) {
1747
1744
  compressible.push(cur);
1748
1745
  cur = null;
1749
1746
  }
@@ -1774,8 +1771,7 @@ function buildCompressibleRanges(messages, state, config, protectedZoneRefs, cou
1774
1771
  const protectedRanges = [];
1775
1772
  let pcur = null;
1776
1773
  for (const info of protectedMsgs) {
1777
- const hasGap = info.gapBefore;
1778
- if (pcur && hasGap) {
1774
+ if (pcur && info.gapBefore) {
1779
1775
  protectedRanges.push(pcur);
1780
1776
  pcur = null;
1781
1777
  }