Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed

Versions 132 to 133

Compare

+34 −0 in 1 place
Lines 139–178 at 133 (were 139–144 at 132)
139139 }
140140}
141141
142+/** 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+}
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 StableSet
165+ ? new StableUnionSet(base, new StableOverlaySet(overlay))
166+ : new Set([...base, ...overlay]);
167+}
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 StableSet
172+ ? new StableDifferenceSet(left, right)
173+ : new Set([...left].filter((value) => !right.has(value)));
174+}
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>;
MCP
compare on this site's /mcp
CLI
abso diff 132 133 src/engine/state-source.ts --json
JSON
/christopher/abso-core/compare/132..133?file=src%2Fengine%2Fstate-source.ts&format=json