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 161 to 162

Compare

+35 −17 in 1 place
Lines 68–111 at 162 (were 68–93 at 161)
6868 * atom key, retaining no candidate set proportional to historical claims. */
6969function* orderedClaimants(g: Graph, streams: IterableIterator<AtomId>[]): IterableIterator<AtomId> {
7070 try {
71− const heads = streams.map((stream) => stream.next());
71+ type Head = { id: AtomId; seq: number; stream: number };
72+ const heap: Head[] = [];
73+ const less = (a: Head, b: Head) => a.seq < b.seq || (a.seq === b.seq && a.stream < b.stream);
74+ const push = (head: Head) => {
75+ let at = heap.length;
76+ heap.push(head);
77+ while (at > 0) {
78+ const parent = (at - 1) >>> 1;
79+ if (!less(head, heap[parent]!)) break;
80+ heap[at] = heap[parent]!;
81+ at = parent;
82+ }
83+ heap[at] = head;
84+ };
85+ const advance = (stream: number) => {
86+ const next = streams[stream]!.next();
87+ if (!next.done) push({ id: next.value, seq: g.atom(next.value).seq, stream });
88+ };
89+ for (let stream = 0; stream < streams.length; stream++) advance(stream);
7290 let previous = -1;
73− for (;;) {
74− let best = -1;
75− let seq = Infinity;
76− for (let i = 0; i < heads.length; i++) {
77− const head = heads[i]!;
78− if (head.done) continue;
79− const current = g.atom(head.value).seq;
80− if (current < seq) {
81− best = i;
82− seq = current;
91+ while (heap.length) {
92+ const head = heap[0]!;
93+ const tail = heap.pop()!;
94+ if (heap.length) {
95+ let at = 0;
96+ while (at * 2 + 1 < heap.length) {
97+ let child = at * 2 + 1;
98+ if (child + 1 < heap.length && less(heap[child + 1]!, heap[child]!)) child++;
99+ if (!less(heap[child]!, tail)) break;
100+ heap[at] = heap[child]!;
101+ at = child;
83102 }
103+ heap[at] = tail;
84104 }
85− if (best < 0) return;
86− const id = heads[best]!.value!;
87− heads[best] = streams[best]!.next();
88− if (seq === previous) continue;
89− previous = seq;
90− yield id;
105+ advance(head.stream);
106+ if (head.seq === previous) continue;
107+ previous = head.seq;
108+ yield head.id;
91109 }
92110 } finally {
93111 for (const stream of streams) stream.return?.();
MCP
compare on this site's /mcp
CLI
abso diff 161 162 worker/project/collisions.ts --json
JSON
/christopher/abso-core/compare/161..162?file=worker%2Fproject%2Fcollisions.ts&format=json