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 142 to 143

Compare

+15 −9 in 7 places
Lines 2–8 at 143 (were 2–8 at 142)
22// text that arrives somewhere else is the same line. Before a publish, those matches become move
33// atoms so the lines keep their ids. Writes go through ExpressMovesHost; today the host is Project.
44
5−import type { AtomId, AttrSet, EditInput, Graph, LineId, MoveInput, View } from "../../src/engine/index.ts";
5+import type { AtomId, AttrSet, EditInput, Graph, LineId, MoveInput, ReadView } from "../../src/engine/index.ts";
66import { differenceSet, StableOverlaySet } from "../../src/engine/state-source.ts";
77import { PLAIN_LINE } from "./collisions.ts";
88import type { AgentState, Entry, Meta, Mode } from "./project-types.ts";
Lines 18–30 at 143 (were 18–29 at 142)
1818export interface ExpressMovesHost {
1919 readonly graph: Graph;
2020 draft(agent: AgentState): AtomId[];
21− agentView(agent: AgentState): View;
22− view(set: ReadonlySet<AtomId>): View;
21+ agentView(agent: AgentState): ReadView;
22+ beforeDraft?(agent: AgentState, draft: readonly AtomId[]): ReadView;
23+ view(set: ReadonlySet<AtomId>): ReadView;
2324 apply(entry: Entry): void;
2425 addDraft(
2526 agent: AgentState,
26− view: View,
27+ view: ReadView,
2728 input: { edits: readonly EditInput[]; attrs?: readonly AttrSet[]; move?: MoveInput },
2829 time: number,
2930 meta: Meta,
Lines 32–38 at 143 (were 31–37 at 142)
3132 ): void;
3233 recordFile(
3334 agent: AgentState,
34− view: View,
35+ view: ReadView,
3536 path: string,
3637 text: string | null | undefined,
3738 time: number,
Lines 60–68 at 143 (were 59–65 at 142)
5960 const g = host.graph;
6061 const mine = new Set(draft);
6162 const after = host.agentView(agent);
62− const before = host.view(differenceSet(after.set, new StableOverlaySet(draft)));
63+ const before = host.beforeDraft
64+ ? host.beforeDraft(agent, draft)
65+ : host.view(differenceSet(after.set, new StableOverlaySet(draft)));
6366 const touched = new Set<string>();
6467 for (const id of draft) for (const file of g.filesOf(id)) touched.add(file);
6568
Lines 174–181 at 143 (were 171–176 at 142)
171174 }
172175 }
173176 }
177+ // Keep the intended membership, but reacquire its reader after each graph mutation.
178+ const finalAgent = { ...agent, mine: [...agent.mine] };
174179 const discard: Entry = { type: "discard", agent: agent.name, atoms: draft.filter((id) => drop.has(id)) };
175180 entries.push(discard);
176181 host.apply(discard);
Lines 185–191 at 143 (were 180–186 at 142)
180185 const start = view.lineNumber(m.from, m.ids[0]!);
181186 if (start < 0 || m.ids.some((id, k) => view.lineNumber(m.from, id) !== start + k)) continue;
182187 // Land after the nearest line above it in the final text that is already there.
183− const finalLines = after.lines(m.to);
188+ const finalLines = host.agentView(finalAgent).lines(m.to);
184189 let at = 0;
185190 for (let i = m.at - 1; i >= 0; i--) {
186191 const n = view.lineNumber(m.to, finalLines[i]!.id);
Lines 205–217 at 143 (were 200–211 at 142)
200205 );
201206 }
202207 for (const path of [...involved].toSorted()) {
203− const was = after.attrs(path);
208+ const finalView = host.agentView(finalAgent);
209+ const was = finalView.attrs(path);
204210 host.recordFile(
205211 agent,
206212 host.agentView(agent),
207213 path,
208− after.hasFile(path) ? after.text(path) : null,
214+ finalView.hasFile(path) ? finalView.text(path) : null,
209215 time,
210216 {},
211217 entries,
MCP
compare on this site's /mcp
CLI
abso diff 142 143 worker/project/express-moves.ts --json
JSON
/christopher/abso-core/compare/142..143?file=worker%2Fproject%2Fexpress-moves.ts&format=json