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

+28 −9 in 4 places
Lines 2–13 at 162 (were 2–12 at 161)
22// the host is Project. Ingest and pluck call landDraft, the inner step.
33
44import { type AtomId, buildAtom, type Graph, type ReadView } from "../../src/engine/index.ts";
5+import { differenceSet, StableOverlaySet, unionOverlay } from "../../src/engine/state-source.ts";
56import type { Pair } from "./collisions.ts";
67import type { DefinitionRule } from "./definition-rule.ts";
78import { ProjectError } from "./project-error.ts";
89import type { AgentState, Collision, Entry, LandAnswer } from "./project-types.ts";
9−import { SHARED, type Space, sharedBaseOf } from "./spaces.ts";
10+import { SHARED, SharedAdditions, type Space, sharedBaseOf } from "./spaces.ts";
1011
1112/** What landing a named draft needs from a project. */
1213export interface LandHost {
Lines 24–30 at 162 (were 23–28 at 161)
2324 setOf(space: Space): ReadonlySet<AtomId>;
2425 at(space: Space, version: number): ReadonlySet<AtomId>;
2526 view(set: ReadonlySet<AtomId>): ReadView;
27+ viewAt(space: Space, version: number, changes?: readonly AtomId[]): ReadView;
2628 sharedView(): ReadView;
2729 pairs(draft: readonly AtomId[], against: ReadonlySet<AtomId>, settled: ReadonlySet<AtomId>): Pair[];
2830 describe(pair: Pair, yoursView: ReadView, theirsView: ReadView, spaceName: string): Collision;
Lines 72–103 at 162 (were 70–90 at 161)
7072 space: Space,
7173 changes: AtomId[],
7274 pick: boolean,
73−): { collisions: Collision[]; newer: Set<AtomId>; union: Set<AtomId> } {
75+): { collisions: Collision[]; newer: ReadonlySet<AtomId>; union: ReadonlySet<AtomId> } {
7476 const shared = host.shared();
7577 const base = host.at(shared, sharedBaseOf(space));
76− const own = new Set(changes);
77− const union = new Set([...shared.own, ...changes]);
78+ const own = new StableOverlaySet(changes);
79+ const current = host.at(shared, host.version());
80+ const union = unionOverlay(current, changes);
7881 // The draft's own changes (some already plucked into shared) are never newer work to it.
79− const newer = new Set([...shared.own].filter((id) => !base.has(id) && !own.has(id) && !space.own.has(id)));
82+ const newer = differenceSet(
83+ differenceSet(
84+ shared.membershipVersion
85+ ? new SharedAdditions(shared, sharedBaseOf(space), base, current)
86+ : differenceSet(current, base),
87+ own,
88+ ),
89+ space.own,
90+ );
8091 // A pluck is checked as the draft's base plus only the plucked changes.
81− const draftView = host.view(pick ? new Set([...base, ...changes]) : host.setOf(space));
92+ const draftView = pick
93+ ? host.viewAt(shared, sharedBaseOf(space), changes)
94+ : host.viewAt(space, space.versions.length - 1);
8295 const describeLand = (p: Pair): Collision => host.describe(p, draftView, host.sharedView(), SHARED);
8396 const collisions = [
8497 ...host.pairs(changes, newer, union).map(describeLand),
8598 ...host
8699 .definitionRule()
87− .collisions(own, draftView, host.view(base), host.sharedView(), newer, SHARED)
100+ .collisions(own, draftView, host.viewAt(shared, sharedBaseOf(space)), host.sharedView(), newer, SHARED)
88101 .map((d) => d.collision),
89102 ];
90103 return { collisions, newer, union };
Lines 120–134 at 162 (were 107–115 at 161)
107120 if (changes.length === 0) return { ok: true, version: host.version(), changes: 0 };
108121 const { collisions, newer, union } = landCollisions(host, space, changes, !!pick);
109122 if (collisions.length > 0) return host.refuse(agent, space, "land", time, collisions, entries);
110− const seen = host.pairs(changes, new Set([...shared.own].filter((id) => !newer.has(id))), union);
123+ const seen = host.pairs(changes, differenceSet(host.at(shared, host.version()), newer), union);
111124 const resolves = [...new Set(seen.flatMap((p) => [p.yours, p.theirs]))];
112− const tie = buildAtom(host.view(union), { author: agent.name, message, time, needs: changes, resolves });
125+ const tie = buildAtom(host.viewAt(shared, host.version(), changes), {
126+ author: agent.name,
127+ message,
128+ time,
129+ needs: changes,
130+ resolves,
131+ });
113132 host.requireClosed(tie, union);
114133 const version = host.version() + 1;
115134 // A pluck leaves the draft where it is: the rest of it lands later.
MCP
compare on this site's /mcp
CLI
abso diff 161 162 worker/project/land.ts --json
JSON
/christopher/abso-core/compare/161..162?file=worker%2Fproject%2Fland.ts&format=json