Files
skills/plugins/document-navigator/docs/foundation/bitpacker/bitpacker-delta/README.md
admin 9bf56a806b Move docs/ package mirror into document-navigator plugin
Relocate the ~6k-file docs tree from the repo root into
plugins/document-navigator/docs/ so the plugin is self-contained and
portable. docs/superpowers/ (specs and plans) stays at the repo root.

Moved via cp+rm rather than git mv because directory rename() fails with
EPERM on this WSL /mnt DrvFs mount; git rename-detection pairs the
identical-content files at commit time.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-30 01:10:00 +01:00

5.0 KiB

@suaveplan/bitpacker-delta - Bitpacker delta plugin

Summary

Delta encoding utilities for efficient repeated state transmission. Detects changes between successive values and encodes differences rather than full values.

Documentation tree

  • delta-manager — (no submodules)
  • delta-state — (no submodules)
  • index — Path: bitpacker-delta/src/index.ts Export: See source for details.
  • string-diff — Path: src/string-diff.ts Export: calculateStringDiff, applyStringDiff, calculateDiffSavings, `shouldUse…
  • xor-encoder — Path: src/xor-encoder.ts Export: calculateXorDelta, applyXorDelta, calculateDeltaBitSize, `isXorEfficie…
- [delta-manager](./src/delta-manager/delta-manager.md) — _(no submodules)_- [delta-state](./src/delta-state/delta-state.md) — _(no submodules)_- [delta-state](./src/delta-state/delta-state.md) — _(no submodules)_- [index](./src/index.md) — **Path:** `bitpacker-delta/src/index.ts` **Export:** See source for details.
  • string-diff — Path: src/string-diff.ts Export: calculateStringDiff, applyStringDiff, calculateDiffSavings, `shouldUse…
  • xor-encoder — Path: src/xor-encoder.ts Export: calculateXorDelta, applyXorDelta, calculateDeltaBitSize, `isXorEfficie…
  • delta-manager — (no submodules)- delta-state — (no submodules)- delta-state — (no submodules)- index — Path: bitpacker-delta/src/index.ts Export: See source for details.
  • string-diff — Path: src/string-diff.ts Export: calculateStringDiff, applyStringDiff, calculateDiffSavings, `shouldUse…
  • xor-encoder — Path: src/xor-encoder.ts Export: calculateXorDelta, applyXorDelta, calculateDeltaBitSize, `isXorEfficie…
  • delta-manager — (no submodules)- delta-state — (no submodules)- delta-state — (no submodules)- index — Path: bitpacker-delta/src/index.ts Export: See source for details.
  • string-diff — Path: src/string-diff.ts Export: calculateStringDiff, applyStringDiff, calculateDiffSavings, `shouldUse…
  • xor-encoder — Path: src/xor-encoder.ts Export: calculateXorDelta, applyXorDelta, calculateDeltaBitSize, `isXorEfficie…
  • delta-manager — (no submodules)- delta-state — (no submodules) - delta-state — (no submodules)- index — Path: bitpacker-delta/src/index.ts Export: See source for details.
  • string-diff — Path: src/string-diff.ts Export: calculateStringDiff, applyStringDiff, calculateDiffSavings, `shouldUse…
  • xor-encoder — Path: src/xor-encoder.ts Export: calculateXorDelta, applyXorDelta, calculateDeltaBitSize, `isXorEfficie…

Install

bun add @suaveplan/bitpacker-delta

Usage

import { DeltaManager, calculateStringDiff, applyStringDiff, numberXor } from "@suaveplan/bitpacker-delta";

// Change detection
const dm = new DeltaManager();
dm.detectChanges({ x: 1, y: 2 }); // returns { x: 1, y: 2 }
dm.detectChanges({ x: 1, y: 2 }); // returns undefined (no change)
dm.detectChanges({ x: 1, y: 3 }); // returns { x: 1, y: 3 }

// String diff
const diff = calculateStringDiff("hello world", "hello there");
// { prefixLen: 6, suffixLen: 0, middleLen: 5, middle: "there" }
const reconstructed = applyStringDiff("hello world", diff);
// "hello there"

// Numeric XOR delta
const delta = numberXor(3.14159, 2.71828);

Modules

  • src/index.ts — DeltaManager, change detection API
  • src/xor-encoder.ts — XOR-based numeric delta encoding
  • src/string-diff.ts — Common prefix/suffix string diff encoding