From 49f62ac2d0323c51e2c5e3b5309692fd5719f76b Mon Sep 17 00:00:00 2001 From: wassname <1103714+wassname@users.noreply.github.com> Date: Thu, 16 Apr 2026 13:09:01 +0800 Subject: [PATCH] feat: clearer overlap error with compress() syntax for valid ranges --- compress-tool.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/compress-tool.ts b/compress-tool.ts index 3078af0..6a26736 100644 --- a/compress-tool.ts +++ b/compress-tool.ts @@ -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}`, ) }