Versions 132 to 133Comparefrom⇄toCompare+34 −0 in 1 placesrc/engine/state-source.ts+34 −0BlameLines 139–178 at 133 (were 139–144 at 132)139139 }140140}141141142+/** Immutable indexed subtraction retains neither operand's enumerated values. */143+export class StableDifferenceSet<T> extends StableSet<T> {144+ readonly left: StableSet<T>;145+ readonly right: StableSet<T>;146+ constructor(left: StableSet<T>, right: StableSet<T>) {147+ super();148+ this.left = left;149+ this.right = right;150+ }151+ get retainedBytes(): number {152+ return 32 + this.left.retainedBytes + this.right.retainedBytes;153+ }154+ has(value: T): boolean {155+ return this.left.has(value) && !this.right.has(value);156+ }157+ *values(): SetIterator<T> {158+ for (const value of this.left) if (!this.right.has(value)) yield value;159+ }160+}161+162+/** Preserve indexed history; only the caller's operation-sized overlay is copied. */163+export function unionOverlay<T>(base: ReadonlySet<T>, overlay: Iterable<T>): ReadonlySet<T> {164+ return base instanceof StableSet165+ ? new StableUnionSet(base, new StableOverlaySet(overlay))166+ : new Set([...base, ...overlay]);167+}168+169+/** Both indexed operands must be immutable for the lifetime of the result. */170+export function differenceSet<T>(left: ReadonlySet<T>, right: ReadonlySet<T>): ReadonlySet<T> {171+ return left instanceof StableSet && right instanceof StableSet172+ ? new StableDifferenceSet(left, right)173+ : new Set([...left].filter((value) => !right.has(value)));174+}175+142176/** An immutable snapshot for the operation's small overlay, not its history. */143177export class StableOverlaySet<T> extends StableSet<T> {144178 readonly #values: Set<T>;MCPcompare on this site's /mcpCLIabso diff 132 133 src/engine/state-source.ts --jsonJSON/christopher/abso-core/compare/132..133?file=src%2Fengine%2Fstate-source.ts&format=json