chore(release): 1.0.7

- Fix Infinity anchorTimestamp repair on JSON round-trip (blocks extending
  to end-of-conversation now restored correctly instead of discarded)
- Fix nextBlockId calculation to use max(id)+1 instead of array length
- Rename internal prompt tag <dcp-message-id> to <dcp-id>
- Add regression tests for corrupted-block resilience (PR #3, @wassname)
- Update README with Contributors section
- Update CHANGELOG for 1.0.7
- Bump package.json to 1.0.7

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Greg Harvell
2026-04-14 14:04:24 -04:00
parent 7cc2b5bbbe
commit 9812beb817
4 changed files with 48 additions and 11 deletions
+23 -10
View File
@@ -81,17 +81,30 @@ export default function (pi: ExtensionAPI) {
const data = entry.data as any
if (data?.compressionBlocks) {
// Filter out blocks with corrupted (null/NaN/Infinity) timestamps —
// these were caused by Infinity anchorTimestamp values that became
// null after JSON round-trip.
const validBlocks = data.compressionBlocks.filter(
(b: any) =>
Number.isFinite(b.startTimestamp) &&
Number.isFinite(b.endTimestamp) &&
Number.isFinite(b.anchorTimestamp),
)
// Filter out blocks with corrupted timestamps, then repair
// anchorTimestamp which is legitimately Infinity for blocks that
// extend to end-of-conversation (JSON round-trips Infinity as null).
const validBlocks = data.compressionBlocks
.filter(
(b: any) =>
Number.isFinite(b.startTimestamp) &&
Number.isFinite(b.endTimestamp),
)
.map((b: any) => ({
...b,
// anchorTimestamp is Infinity when the block extends to the end
// of the conversation; JSON round-trips Infinity as null, so
// repair it here rather than discarding the block.
anchorTimestamp: Number.isFinite(b.anchorTimestamp)
? b.anchorTimestamp
: Infinity,
}))
state.compressionBlocks = validBlocks
state.nextBlockId = data.nextBlockId ?? state.compressionBlocks.length
state.nextBlockId =
data.nextBlockId ??
(state.compressionBlocks.length > 0
? Math.max(0, ...state.compressionBlocks.map((b: any) => b.id)) + 1
: 1)
state.tokensSaved = data.tokensSaved ?? 0
state.totalPruneCount = data.totalPruneCount ?? 0
}