fix: gap calculation scoped to requested range, clearer error text

This commit is contained in:
wassname
2026-04-16 13:14:49 +08:00
parent 779e5cc240
commit b825dbcf77
2 changed files with 4 additions and 18 deletions
+2 -1
View File
@@ -173,6 +173,7 @@ export function registerCompressTool(
const sortedEntries = [...state.messageIdSnapshot.entries()]
.filter(([id]) => id.startsWith('m')) // only mNNN ids
.filter(([, ts]) => ts >= startTimestamp && ts <= endTimestamp) // only within requested range
.sort((a, b) => a[1] - b[1])
// Walk sorted messages, grouping consecutive uncovered ones into gap ranges
@@ -213,7 +214,7 @@ export function registerCompressTool(
throw new Error(
`[compress] Range {startId: "${startId}", endId: "${endId}"} overlaps existing summaries: ${overlapInfo}. ` +
`Available ranges: ${gapInfo}`,
`Available ranges within your requested range: ${gapInfo}`,
)
}
+2 -17
View File
@@ -1,12 +1,12 @@
{
"name": "@complexthings/pi-dynamic-context-pruning",
"version": "1.0.6",
"version": "1.0.7",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@complexthings/pi-dynamic-context-pruning",
"version": "1.0.6",
"version": "1.0.7",
"dependencies": {
"jsonc-parser": "^3.3.1"
},
@@ -913,9 +913,6 @@
"cpu": [
"arm64"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -933,9 +930,6 @@
"cpu": [
"arm64"
],
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -953,9 +947,6 @@
"cpu": [
"riscv64"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -973,9 +964,6 @@
"cpu": [
"x64"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -993,9 +981,6 @@
"cpu": [
"x64"
],
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [