feat: clearer overlap error with compress() syntax for valid ranges

This commit is contained in:
wassname
2026-04-16 13:09:01 +08:00
parent 32e9d67fa9
commit 49f62ac2d0
+4 -5
View File
@@ -205,13 +205,12 @@ export function registerCompressTool(
.join(', ')
const gapInfo = gaps.length > 0
? gaps.join('; ')
: 'None — all visible messages are covered by existing blocks'
? gaps.map(g => `compress(${g.replace('..', ', ')})`).join('; ')
: 'none available — all visible messages are covered by existing blocks'
throw new Error(
`Overlapping compression ranges are not supported. ` +
`New range (${startId}..${endId}) overlaps existing block(s): ${overlapInfo}. ` +
`Valid compressible ranges: ${gapInfo}`,
`You tried compress(${startId}, ${endId}) but this overlaps existing summaries: ${overlapInfo}. ` +
`Instead use: ${gapInfo}`,
)
}