acp-kernel 0.0.95-pr.235.306 → 0.0.95

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.
@@ -43,8 +43,8 @@ export declare function resolveBoundaries(input: ResolveBoundariesInput): Resolv
43
43
  * active block whose raws were pruned becomes unresolvable and cannot be
44
44
  * promoted (dog/billion-context-pi#195).
45
45
  */
46
- export declare function visibleBlockAnchor(block: CompressionBlock, indexByMessageId: Map<string, number>, baseIndexById?: Map<string, number>): number | null;
47
- export declare function blockVisibleInRange(block: CompressionBlock, indexByMessageId: Map<string, number>, startIndex: number, endIndex: number, baseIndexById?: Map<string, number>): boolean;
48
- export declare function earliestIndexOfIds(ids: string[], indexByMessageId: Map<string, number>, baseIndexById?: Map<string, number>): number | null;
46
+ export declare function visibleBlockAnchor(block: CompressionBlock, indexByMessageId: Map<string, number>): number | null;
47
+ export declare function blockVisibleInRange(block: CompressionBlock, indexByMessageId: Map<string, number>, startIndex: number, endIndex: number): boolean;
48
+ export declare function earliestIndexOfIds(ids: string[], indexByMessageId: Map<string, number>): number | null;
49
49
  export declare function toResolvedBoundary(range: ResolvedRange): ResolvedBoundary;
50
50
  //# sourceMappingURL=boundaries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"boundaries.d.ts","sourceRoot":"","sources":["../src/boundaries.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,OAAO,CAAC;AAE/C,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,YAAY,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;CACb;AAKD,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAehE;AAED;;;;;;GAMG;AACH,qBAAa,qBAA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AG,CAAC,MAAM,CAAC,EACnC,KAAK,EAAE,gBAAgB,GACtB,qBAAqB,CAiCvB;AAED,MAAM,WAAW,sBAAsB;IACrC,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,6GAA6G;IAC7G,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,kKAAkK;IAClK,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,gBAAgB,EACvB,QAAQ,EAAE,WAAW,EAAE,EACvB,OAAO,GAAE,qBAA0B,GAClC,sBAAsB,CAwCxB;AAeD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,IAAI,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB;;gCAE4B;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qEAAqE;IACrE,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;wEAIwE;AACxE,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,MAAM,GACd;IAAE,KAAK,EAAE,gBAAgB,CAAC;IAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAA;CAAE,CAejE;AAED;;;;mCAImC;AACnC,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,MAAM,GACd,MAAM,EAAE,CAgBV"}
package/dist/index.js CHANGED
@@ -1641,20 +1641,14 @@ function resolveBoundaries(input) {
1641
1641
  );
1642
1642
  }
1643
1643
  const indexByMessageId = /* @__PURE__ */ new Map();
1644
- const baseIndexById = /* @__PURE__ */ new Map();
1645
- input.messages.forEach((message, index) => {
1646
- indexByMessageId.set(message.id, index);
1647
- const base = baseIdOf(message.id);
1648
- const existing = baseIndexById.get(base);
1649
- if (existing === void 0 || index < existing)
1650
- baseIndexById.set(base, index);
1651
- });
1644
+ input.messages.forEach(
1645
+ (message, index) => indexByMessageId.set(message.id, index)
1646
+ );
1652
1647
  let snappedBoundaries = [];
1653
1648
  const startAnchor = resolveAnchorIndex(
1654
1649
  start,
1655
1650
  input.state,
1656
1651
  indexByMessageId,
1657
- baseIndexById,
1658
1652
  "start"
1659
1653
  );
1660
1654
  if (startAnchor.snapped) snappedBoundaries.push(startAnchor.snapped);
@@ -1662,7 +1656,6 @@ function resolveBoundaries(input) {
1662
1656
  end,
1663
1657
  input.state,
1664
1658
  indexByMessageId,
1665
- baseIndexById,
1666
1659
  "end"
1667
1660
  );
1668
1661
  if (endAnchor.snapped) snappedBoundaries.push(endAnchor.snapped);
@@ -1683,13 +1676,7 @@ function resolveBoundaries(input) {
1683
1676
  const nestedBlockIds = [];
1684
1677
  const nestedSeen = /* @__PURE__ */ new Set();
1685
1678
  for (const block of activeBlocks(input.state)) {
1686
- if (blockVisibleInRange(
1687
- block,
1688
- indexByMessageId,
1689
- startIndex,
1690
- endIndex,
1691
- baseIndexById
1692
- )) {
1679
+ if (blockVisibleInRange(block, indexByMessageId, startIndex, endIndex)) {
1693
1680
  if (!nestedSeen.has(block.blockId)) {
1694
1681
  nestedSeen.add(block.blockId);
1695
1682
  nestedBlockIds.push(block.blockId);
@@ -1708,7 +1695,7 @@ function resolveBoundaries(input) {
1708
1695
  reversedNote
1709
1696
  };
1710
1697
  }
1711
- function resolveAnchorIndex(boundary, state, indexByMessageId, baseIndexById, endpoint) {
1698
+ function resolveAnchorIndex(boundary, state, indexByMessageId, endpoint) {
1712
1699
  const label = endpoint === "start" ? "startId" : "endId";
1713
1700
  if (boundary.kind === "message") {
1714
1701
  const rawId = state.messageRefs.byRef[boundary.raw] ?? state.messageRefs.byRef[formatPaddedRef(boundary.numericId)];
@@ -1719,16 +1706,11 @@ function resolveAnchorIndex(boundary, state, indexByMessageId, baseIndexById, en
1719
1706
  `${label}="${boundary.raw}" does not exist in this session (typo or wrong session) \u2014 run acp_status for current refs.`
1720
1707
  );
1721
1708
  }
1722
- const index = indexByMessageId.get(rawId) ?? baseIndexById.get(baseIdOf(rawId));
1709
+ const index = indexByMessageId.get(rawId);
1723
1710
  if (index !== void 0) {
1724
1711
  return { index, snapped: null };
1725
1712
  }
1726
- const owner2 = activeOwnerAnchor(
1727
- state,
1728
- [rawId],
1729
- indexByMessageId,
1730
- baseIndexById
1731
- );
1713
+ const owner2 = activeOwnerAnchor(state, [rawId], indexByMessageId);
1732
1714
  if (owner2 !== null) {
1733
1715
  return {
1734
1716
  index: owner2,
@@ -1771,7 +1753,7 @@ function resolveAnchorIndex(boundary, state, indexByMessageId, baseIndexById, en
1771
1753
  );
1772
1754
  }
1773
1755
  if (block.active) {
1774
- const anchor = visibleBlockAnchor(block, indexByMessageId, baseIndexById);
1756
+ const anchor = visibleBlockAnchor(block, indexByMessageId);
1775
1757
  if (anchor !== null) {
1776
1758
  return { index: anchor, snapped: null };
1777
1759
  }
@@ -1779,8 +1761,7 @@ function resolveAnchorIndex(boundary, state, indexByMessageId, baseIndexById, en
1779
1761
  const owner = activeOwnerAnchor(
1780
1762
  state,
1781
1763
  block.effectiveMessageIds,
1782
- indexByMessageId,
1783
- baseIndexById
1764
+ indexByMessageId
1784
1765
  );
1785
1766
  if (owner !== null) {
1786
1767
  return {
@@ -1801,10 +1782,9 @@ function resolveAnchorIndex(boundary, state, indexByMessageId, baseIndexById, en
1801
1782
  `${label}="b${boundary.numericId}" is an active block but none of its content (raw messages or rendered summary) is visible in the current context \u2014 run acp_status to verify.`
1802
1783
  );
1803
1784
  }
1804
- function activeOwnerAnchor(state, ownedIds, indexByMessageId, baseIndexById) {
1785
+ function activeOwnerAnchor(state, ownedIds, indexByMessageId) {
1805
1786
  if (ownedIds.length === 0) return null;
1806
- const owned = /* @__PURE__ */ new Set();
1807
- for (const id of ownedIds) owned.add(baseIdOf(id));
1787
+ const owned = new Set(ownedIds);
1808
1788
  let best = null;
1809
1789
  for (const block of state.blocks) {
1810
1790
  if (!block.active) continue;
@@ -1817,7 +1797,7 @@ function activeOwnerAnchor(state, ownedIds, indexByMessageId, baseIndexById) {
1817
1797
  }
1818
1798
  }
1819
1799
  if (!ownsInherited) continue;
1820
- const anchor = visibleBlockAnchor(block, indexByMessageId, baseIndexById);
1800
+ const anchor = visibleBlockAnchor(block, indexByMessageId);
1821
1801
  if (anchor === null) continue;
1822
1802
  if (best === null || anchor < best) {
1823
1803
  best = anchor;
@@ -1830,7 +1810,7 @@ function inheritedContentIds(state, block) {
1830
1810
  for (const childId of block.directBlockIds) {
1831
1811
  const child = blockById(state, childId);
1832
1812
  if (!child) continue;
1833
- for (const id of child.effectiveMessageIds) ids.add(baseIdOf(id));
1813
+ for (const id of child.effectiveMessageIds) ids.add(id);
1834
1814
  }
1835
1815
  return ids;
1836
1816
  }
@@ -1857,47 +1837,32 @@ function snapToNeighborVisible(state, indexByMessageId, refNumber, endpoint) {
1857
1837
  function formatPaddedRef(index) {
1858
1838
  return `m${String(index).padStart(5, "0")}`;
1859
1839
  }
1860
- function visibleBlockAnchor(block, indexByMessageId, baseIndexById) {
1840
+ function visibleBlockAnchor(block, indexByMessageId) {
1861
1841
  const summaryIndex = indexByMessageId.get(summaryMessageId(block.blockId));
1862
1842
  if (summaryIndex !== void 0) return summaryIndex;
1863
- return earliestIndexOfIds(
1864
- block.effectiveMessageIds,
1865
- indexByMessageId,
1866
- baseIndexById
1867
- );
1843
+ return earliestIndexOfIds(block.effectiveMessageIds, indexByMessageId);
1868
1844
  }
1869
- function blockVisibleInRange(block, indexByMessageId, startIndex, endIndex, baseIndexById) {
1845
+ function blockVisibleInRange(block, indexByMessageId, startIndex, endIndex) {
1870
1846
  const summaryIndex = indexByMessageId.get(summaryMessageId(block.blockId));
1871
1847
  if (summaryIndex !== void 0 && summaryIndex >= startIndex && summaryIndex <= endIndex) {
1872
1848
  return true;
1873
1849
  }
1874
1850
  const rawIndex = earliestIndexOfIds(
1875
1851
  block.effectiveMessageIds,
1876
- indexByMessageId,
1877
- baseIndexById
1852
+ indexByMessageId
1878
1853
  );
1879
1854
  return rawIndex !== null && rawIndex >= startIndex && rawIndex <= endIndex;
1880
1855
  }
1881
- function earliestIndexOfIds(ids, indexByMessageId, baseIndexById) {
1882
- const baseIndex = baseIndexById ?? deriveBaseIndex(indexByMessageId);
1856
+ function earliestIndexOfIds(ids, indexByMessageId) {
1883
1857
  let earliest = null;
1884
1858
  for (const id of ids) {
1885
- const index = baseIndex.get(baseIdOf(id));
1859
+ const index = indexByMessageId.get(id);
1886
1860
  if (index !== void 0 && (earliest === null || index < earliest)) {
1887
1861
  earliest = index;
1888
1862
  }
1889
1863
  }
1890
1864
  return earliest;
1891
1865
  }
1892
- function deriveBaseIndex(indexByMessageId) {
1893
- const baseIndex = /* @__PURE__ */ new Map();
1894
- for (const [id, index] of indexByMessageId) {
1895
- const base = baseIdOf(id);
1896
- const existing = baseIndex.get(base);
1897
- if (existing === void 0 || index < existing) baseIndex.set(base, index);
1898
- }
1899
- return baseIndex;
1900
- }
1901
1866
 
1902
1867
  // src/block-map.ts
1903
1868
  function refNum(ref) {
@@ -1946,12 +1911,10 @@ function parseBlockIdArg(arg) {
1946
1911
  }
1947
1912
  function findBlocksOverlappingMessages(state, messageIds) {
1948
1913
  if (messageIds.size === 0) return [];
1949
- const messageBases = /* @__PURE__ */ new Set();
1950
- for (const id of messageIds) messageBases.add(baseIdOf(id));
1951
1914
  const matched = [];
1952
1915
  for (const block of state.blocks) {
1953
1916
  if (!block.active) continue;
1954
- if (block.effectiveMessageIds.some((id) => messageBases.has(baseIdOf(id)))) {
1917
+ if (block.effectiveMessageIds.some((id) => messageIds.has(id))) {
1955
1918
  matched.push(block);
1956
1919
  }
1957
1920
  }
@@ -2010,15 +1973,13 @@ function deactivateBlock(state, blockIds, options = {}) {
2010
1973
  return { ...state, blocks: final };
2011
1974
  }
2012
1975
  function buildRestoredContentPreview(messages, beforeActiveMessageIds, state) {
2013
- const coveredBases = /* @__PURE__ */ new Set();
2014
- for (const b of state.blocks) {
2015
- if (!b.active) continue;
2016
- for (const id of b.effectiveMessageIds) coveredBases.add(baseIdOf(id));
2017
- }
2018
1976
  const restored = [];
2019
1977
  for (const message of messages) {
2020
1978
  if (!beforeActiveMessageIds.has(message.id)) continue;
2021
- if (!coveredBases.has(baseIdOf(message.id))) restored.push(message);
1979
+ const stillCovered = state.blocks.some(
1980
+ (b) => b.active && b.effectiveMessageIds.includes(message.id)
1981
+ );
1982
+ if (!stillCovered) restored.push(message);
2022
1983
  }
2023
1984
  if (restored.length === 0) return { preview: "", restoredCount: 0 };
2024
1985
  const lines = [];
@@ -2037,26 +1998,19 @@ function buildRestoredContentPreview(messages, beforeActiveMessageIds, state) {
2037
1998
  }
2038
1999
  function collectBlockContent(state, block, messages, options = {}) {
2039
2000
  const full = options.full ?? false;
2040
- const targetBases = /* @__PURE__ */ new Set();
2041
- for (const id of block.effectiveMessageIds) targetBases.add(baseIdOf(id));
2001
+ const targetIds = new Set(block.effectiveMessageIds);
2042
2002
  if (full) {
2043
- const msgs = messages.filter(
2044
- (m) => m.id !== void 0 && targetBases.has(baseIdOf(m.id))
2045
- );
2003
+ const msgs = messages.filter((m) => targetIds.has(m.id));
2046
2004
  if (msgs.length === 0) return { text: "", count: 0 };
2047
- return {
2048
- text: msgs.map(formatMessage).join("\n\n"),
2049
- count: msgs.length
2050
- };
2005
+ return { text: msgs.map(formatMessage).join("\n\n"), count: msgs.length };
2051
2006
  }
2052
2007
  const nestedChildren = [];
2053
- const nestedCoveredBases = /* @__PURE__ */ new Set();
2008
+ const nestedCovered = /* @__PURE__ */ new Set();
2054
2009
  for (const childId of block.directBlockIds) {
2055
2010
  const child = state.blocks.find((b) => b.blockId === childId);
2056
2011
  if (!child?.active) continue;
2057
2012
  nestedChildren.push(child);
2058
- for (const id of child.effectiveMessageIds)
2059
- nestedCoveredBases.add(baseIdOf(id));
2013
+ for (const id of child.effectiveMessageIds) nestedCovered.add(id);
2060
2014
  }
2061
2015
  const parts = [];
2062
2016
  for (const child of nestedChildren) {
@@ -2066,7 +2020,7 @@ ${child.summary}`);
2066
2020
  }
2067
2021
  let directCount = 0;
2068
2022
  for (const m of messages) {
2069
- if (m.id !== void 0 && targetBases.has(baseIdOf(m.id)) && !nestedCoveredBases.has(baseIdOf(m.id))) {
2023
+ if (targetIds.has(m.id) && !nestedCovered.has(m.id)) {
2070
2024
  parts.push(formatMessage(m));
2071
2025
  directCount++;
2072
2026
  }
@@ -4303,28 +4257,22 @@ function segmentGroups(items) {
4303
4257
  function estimateTextTokens(text) {
4304
4258
  return Math.ceil(text.length / 4);
4305
4259
  }
4306
- function activeBlockCoveredBases(state) {
4307
- const covered = /* @__PURE__ */ new Set();
4308
- for (const block of state.blocks) {
4309
- if (!block.active) continue;
4310
- for (const id of block.effectiveMessageIds) covered.add(baseIdOf(id));
4311
- }
4312
- return covered;
4313
- }
4314
- function isSyntheticOrPruned(message, coveredBases) {
4260
+ function isSyntheticOrPruned(message, state) {
4315
4261
  if (message.text?.startsWith("[Compressed conversation section]"))
4316
4262
  return true;
4317
- if (message.id === void 0) return false;
4318
- return coveredBases.has(baseIdOf(message.id));
4263
+ for (const block of state.blocks) {
4264
+ if (block.active && block.effectiveMessageIds.includes(message.id))
4265
+ return true;
4266
+ }
4267
+ return false;
4319
4268
  }
4320
4269
  function computeProtectedRefs(messages, state, config, countTokens = estimateTextTokens) {
4321
4270
  const preserveN = config.preserveRecentMessages;
4322
4271
  const preserveTokens = config.preserveRecentTokens;
4323
4272
  const result = /* @__PURE__ */ new Set();
4324
4273
  const visible = [];
4325
- const coveredBases = activeBlockCoveredBases(state);
4326
4274
  for (const msg of messages) {
4327
- if (isSyntheticOrPruned(msg, coveredBases)) continue;
4275
+ if (isSyntheticOrPruned(msg, state)) continue;
4328
4276
  if (isNeverPreserveRecent(
4329
4277
  msg,
4330
4278
  config.neverPreserveRecentTools,
@@ -4350,8 +4298,7 @@ function computeProtectedRefs(messages, state, config, countTokens = estimateTex
4350
4298
  if (preserveN > 0) {
4351
4299
  for (let i = messages.length - 1; i >= 0; i--) {
4352
4300
  const msg = messages[i];
4353
- if (msg.role !== "user" || isSyntheticOrPruned(msg, coveredBases))
4354
- continue;
4301
+ if (msg.role !== "user" || isSyntheticOrPruned(msg, state)) continue;
4355
4302
  const ref = state.messageRefs.byRaw[msg.id];
4356
4303
  if (ref && ref !== "BLOCKED") result.add(ref);
4357
4304
  break;
@@ -4368,12 +4315,11 @@ function buildCompressibleRanges(messages, state, config, protectedZoneRefs, cou
4368
4315
  let skipSinceCompressible = false;
4369
4316
  let skipSinceProtected = false;
4370
4317
  let msgIndex = -1;
4371
- const coveredBases = activeBlockCoveredBases(state);
4372
4318
  for (const msg of messages) {
4373
4319
  msgIndex++;
4374
4320
  const ref = state.messageRefs.byRaw[msg.id];
4375
4321
  if (!ref || ref === "BLOCKED") continue;
4376
- if (isSyntheticOrPruned(msg, coveredBases)) {
4322
+ if (isSyntheticOrPruned(msg, state)) {
4377
4323
  skipSinceCompressible = true;
4378
4324
  skipSinceProtected = true;
4379
4325
  continue;
@@ -4591,22 +4537,16 @@ function refGateDiagnostics(state, requestedRanges, unknownCount) {
4591
4537
  }
4592
4538
  function danglingMessageRefs(state, messages, spec) {
4593
4539
  const visible = new Set(messages.map((m) => m.id));
4594
- const visibleBases = /* @__PURE__ */ new Set();
4595
- for (const id of visible) visibleBases.add(baseIdOf(id));
4596
- const coveredBases = /* @__PURE__ */ new Set();
4597
- for (const block of state.blocks) {
4598
- if (!block.active) continue;
4599
- for (const id of block.effectiveMessageIds) coveredBases.add(baseIdOf(id));
4600
- }
4601
4540
  const dangling = [];
4602
4541
  for (const ref of [spec.startRef, spec.endRef]) {
4603
4542
  const parsed = parseBoundary(ref);
4604
4543
  if (!parsed || parsed.kind !== "message") continue;
4605
4544
  const rawId = state.messageRefs.byRef[parsed.raw] ?? state.messageRefs.byRef[indexToRef(parsed.numericId)];
4606
- if (!rawId) continue;
4607
- const base = baseIdOf(rawId);
4608
- if (visible.has(rawId) || visibleBases.has(base)) continue;
4609
- if (!coveredBases.has(base)) dangling.push(parsed.raw);
4545
+ if (!rawId || visible.has(rawId)) continue;
4546
+ const covered = state.blocks.some(
4547
+ (block) => block.active && block.effectiveMessageIds.includes(rawId)
4548
+ );
4549
+ if (!covered) dangling.push(parsed.raw);
4610
4550
  }
4611
4551
  return dangling;
4612
4552
  }
@@ -5311,25 +5251,13 @@ function applySingleRange(input) {
5311
5251
  );
5312
5252
  if (rangeMessageIds.length > resolved.messageIds.length) {
5313
5253
  const indexByMessageId = /* @__PURE__ */ new Map();
5314
- const baseIndexById = /* @__PURE__ */ new Map();
5315
- input.messages.forEach((m, i) => {
5316
- indexByMessageId.set(m.id, i);
5317
- const base = baseIdOf(m.id);
5318
- const existing = baseIndexById.get(base);
5319
- if (existing === void 0 || i < existing) baseIndexById.set(base, i);
5320
- });
5254
+ input.messages.forEach((m, i) => indexByMessageId.set(m.id, i));
5321
5255
  const adjustedStart = rangeMessageIds.length > 0 ? indexByMessageId.get(rangeMessageIds[0]) ?? resolved.startIndex : resolved.startIndex;
5322
5256
  const adjustedEnd = rangeMessageIds.length > 0 ? indexByMessageId.get(rangeMessageIds[rangeMessageIds.length - 1]) ?? resolved.endIndex : resolved.endIndex;
5323
5257
  const nestedSeen = new Set(resolved.nestedBlockIds);
5324
5258
  for (const block2 of activeBlocks(input.state)) {
5325
5259
  if (nestedSeen.has(block2.blockId)) continue;
5326
- if (blockVisibleInRange(
5327
- block2,
5328
- indexByMessageId,
5329
- adjustedStart,
5330
- adjustedEnd,
5331
- baseIndexById
5332
- )) {
5260
+ if (blockVisibleInRange(block2, indexByMessageId, adjustedStart, adjustedEnd)) {
5333
5261
  nestedSeen.add(block2.blockId);
5334
5262
  resolved.nestedBlockIds.push(block2.blockId);
5335
5263
  }
@@ -5355,7 +5283,7 @@ function applySingleRange(input) {
5355
5283
  }
5356
5284
  }
5357
5285
  const directMessageIds = [...effectiveMessageIds].filter(
5358
- (id) => !input.preExistingCoverage.has(baseIdOf(id))
5286
+ (id) => !input.preExistingCoverage.has(id)
5359
5287
  );
5360
5288
  let filteredIds = filterProtectedToolMessages(
5361
5289
  directMessageIds,
@@ -5588,7 +5516,7 @@ function resolveTargetTier(state, nestedBlockIds, isBlockBoundary) {
5588
5516
  function collectCoverage(state) {
5589
5517
  const coverage = /* @__PURE__ */ new Set();
5590
5518
  for (const block of activeBlocks(state)) {
5591
- for (const id of block.effectiveMessageIds) coverage.add(baseIdOf(id));
5519
+ for (const id of block.effectiveMessageIds) coverage.add(id);
5592
5520
  }
5593
5521
  return coverage;
5594
5522
  }
@@ -6156,7 +6084,7 @@ function collectVisible(messages, state, countTokens) {
6156
6084
  const coveredIds = /* @__PURE__ */ new Set();
6157
6085
  for (const block of state.blocks) {
6158
6086
  if (!block.active) continue;
6159
- for (const id of block.effectiveMessageIds) coveredIds.add(baseIdOf(id));
6087
+ for (const id of block.effectiveMessageIds) coveredIds.add(id);
6160
6088
  }
6161
6089
  let summaryTokens = 0;
6162
6090
  for (const block of state.blocks) {
@@ -6174,7 +6102,7 @@ function collectVisible(messages, state, countTokens) {
6174
6102
  const ref = refForRaw(state.messageRefs, message.id);
6175
6103
  if (!ref) return;
6176
6104
  const tokens = countMessageTokens(message, countTokens);
6177
- if (!coveredIds.has(baseIdOf(message.id)) && tokens > 0) {
6105
+ if (!coveredIds.has(message.id) && tokens > 0) {
6178
6106
  const isTool = isToolMessage(message);
6179
6107
  const tool = isTool ? message.toolName ?? (message.toolCallId ? toolCallNames.get(message.toolCallId) : void 0) ?? "tool" : "text";
6180
6108
  visible.push({