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 57 to 318

Compare

+18 −28 in 4 places
Lines 126–153 at 318 (were 126–147 at 57)
126126/** `a` has the lower seq. */
127127function makeConflict(graph: Graph, set: AtomSet | undefined, a: Atom, b: Atom, keys: ConflictKey[]): Conflict {
128128 const kind = keys.every((k) => k.relation === "hold") ? "semantic" : "edit-edit";
129− let resolvedBy: AtomId[] = [];
129+ const resolvedBy: AtomId[] = [];
130130 if (set) {
131− const fromA = graph.resolversOf(a.id).filter((r) => set.has(r));
132− const fromB = new Set(graph.resolversOf(b.id));
133− resolvedBy = fromA.filter((r) => fromB.has(r)).sort((p, q) => graph.atom(p).seq - graph.atom(q).seq);
131+ // Resolver indexes append in sequence order: intersect without copying either history.
132+ const left = graph.eachResolverOf(a.id);
133+ const right = graph.eachResolverOf(b.id);
134+ let p = left.next();
135+ let q = right.next();
136+ while (!p.done && !q.done) {
137+ const order = graph.atom(p.value).seq - graph.atom(q.value).seq;
138+ if (order === 0 && set.has(p.value)) resolvedBy.push(p.value);
139+ if (order <= 0) p = left.next();
140+ if (order >= 0) q = right.next();
141+ }
134142 }
135143 return { atoms: [a.id, b.id], kind, keys, sides: [side(a), side(b)], resolvedBy };
136144}
137145
138146/** Atoms in the set that claim (write, read or hold) a key. */
139−function claimersIn(graph: Graph, set: AtomSet, key: Key): AtomId[] {
140− const out: AtomId[] = [];
141− for (const list of [graph.writersOf(key), graph.readersOf(key), graph.holdersOf(key)]) {
142− for (const id of list) if (set.has(id)) out.push(id);
147+function* claimersIn(graph: Graph, set: AtomSet, key: Key): IterableIterator<AtomId> {
148+ for (const list of [graph.eachWriterOf(key), graph.eachReaderOf(key), graph.eachHolderOf(key)]) {
149+ for (const id of list) if (set.has(id)) yield id;
143150 }
144− return out;
145151}
146152
147153const bySeq =
Lines 207–213 at 318 (were 201–223 at 57)
201207function visibleNeighbours(view: View, graph: Graph, line: LineId): LineId[] {
202208 const info = graph.line(line);
203209 if (!info) return [];
204− const sequence = view.sequence(info.file);
205− const at = view.sequenceIndex(info.file, line);
206− if (at < 0) return [];
207− const out: LineId[] = [];
208− for (let i = at - 1; i >= 0; i--) {
209− if (sequence[i]!.visible) {
210− out.push(sequence[i]!.id);
211− break;
212− }
213− }
214− for (let i = at + 1; i < sequence.length; i++) {
215− if (sequence[i]!.visible) {
216− out.push(sequence[i]!.id);
217− break;
218− }
219− }
220− return out;
210+ return view.visibleNeighbours(info.file, line);
221211}
222212
223213/**
Lines 245–251 at 318 (were 255–261 at 57)
255245 const seen = new Set<string>();
256246 for (const a of [...changed].sort(bySeq(graph))) {
257247 if (a === atom.id) continue;
258− for (const link of graph.togetherLinks(a)) {
248+ for (const link of graph.eachTogetherLink(a)) {
259249 const b = link.other;
260250 if (b === atom.id || !set.has(b) || acknowledged.has(b)) continue;
261251 const tag = `${a} ${b}`;
Lines 292–298 at 318 (were 302–308 at 57)
302292 const below = graph.closureOf(draft.deps);
303293 const candidates = new Set<AtomId>();
304294 for (const key of draft.writes) for (const id of claimersIn(graph, set, key)) candidates.add(id);
305− for (const key of claimsOf(draft)) for (const id of graph.writersOf(key)) if (set.has(id)) candidates.add(id);
295+ for (const key of claimsOf(draft)) for (const id of graph.eachWriterOf(key)) if (set.has(id)) candidates.add(id);
306296 const found: Conflict[] = [];
307297 for (const id of [...candidates].sort(bySeq(graph))) {
308298 const other = graph.atom(id);
MCP
compare on this site's /mcp
CLI
abso diff 57 318 src/engine/conflicts.ts --json
JSON
/christopher/abso-core/compare/57..318?file=src%2Fengine%2Fconflicts.ts&format=json