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

Compare

+22 −21 in 5 places
Lines 1–5 at 318 (were 1–4 at 154)
11import type { Graph } from "../graph.ts";
2+import { equalJsonValues } from "../json-value-chunks.ts";
23import { orderedChildKey } from "../ordered-index.ts";
34import { resolveScratchMoves } from "../relocation-scratch.ts";
45import type { GraphStateStorage } from "../state-source.ts";
Lines 113–138 at 318 (were 112–133 at 154)
112113 }
113114 apply(previous: MarkerState, atom: Atom): MarkerState {
114115 this.assertContext(previous);
115− if (JSON.stringify(this.graph.atom(atom.id)) !== JSON.stringify(atom)) throw Error("canonical atom mismatch");
116+ if (!equalJsonValues(this.graph.atom(atom.id), atom)) throw Error("canonical atom mismatch");
116117 if (this.members.get(previous.membership, atom.seq)?.present) return previous;
117118 for (const id of atom.deps)
118119 if (!this.members.get(previous.membership, this.graph.atom(id).seq)?.present) throw Error("missing dependency");
119120 return this.storage.transaction(() => {
120121 const state = { ...previous };
121− const sequence = this.sequence;
122122 this.ensureFile(state, this.path);
123123 for (const run of atom.inserts) this.ensureFile(state, run.file);
124− let k = 0;
125− for (const run of atom.inserts) for (const _ of run.lines) this.insertLine(state, `${atom.id}.${k++}`);
124+ for (const line of this.graph.eachInsertedLine(atom.id)) this.insertLine(state, line);
125+ let visibility: Array<{ kind: "visibility"; id: number; delta: number }> = [];
126126 for (const line of atom.deletes) {
127127 const marker = this.markers.get(state.locator, this.graph.lineN(line) + 1);
128128 if (!marker) throw Error("missing deleted marker");
129− state.sequence = sequence.update(state.sequence, { kind: "visibility", id: marker.enter, delta: 1 });
129+ visibility.push({ kind: "visibility", id: marker.enter, delta: 1 });
130+ if (visibility.length === 16) {
131+ state.sequence = this.sequence.updateMany(state.sequence, visibility);
132+ visibility = [];
133+ }
130134 }
135+ if (visibility.length) state.sequence = this.sequence.updateMany(state.sequence, visibility);
131136 for (const id of atom.deps) {
132137 const seq = this.graph.atom(id).seq,
133138 member = required(this.members.get(state.membership, seq));
Lines 148–153 at 318 (were 143–154 at 154)
143148 insertLine(state: MarkerState, line: string): void {
144149 this.assertContext(state);
145150 const sequence = this.sequence;
146− const insert = (rank: number, text: string, hidden = false): number => {
147− const id = state.sequence.next;
148− state.sequence = sequence.update(state.sequence, { kind: "insert", rank, text });
149− if (hidden) state.sequence = sequence.update(state.sequence, { kind: "visibility", id, delta: 1 });
150− return id;
151− };
152151 const n = this.graph.lineN(line),
153152 parent = this.graph.parentCodeOf(n);
154153 if (n + 1 >= 0x80000000) throw Error("prototype line identity limit");
Lines 174–185 at 318 (were 175–182 at 154)
175174 preceding === undefined ? parentMarker.enter : required(this.markers.get(state.locator, preceding + 1)).exit;
176175 state.children = this.childRoots.set(state.children, parentKey, { root: index.insert(root, key, n) });
177176 const at = sequence.rank(state.sequence, anchor) + 1;
178− const enter = insert(at, line),
179− exit = insert(at + 1, `${line}:end`, true);
177+ const enter = state.sequence.next,
178+ exit = enter + 1;
179+ state.sequence = sequence.updateMany(state.sequence, [
180+ { kind: "insert", rank: at, text: line },
181+ { kind: "insert", rank: at + 1, text: `${line}:end`, hidden: true },
182+ ]);
180183 state.locator = this.markers.set(state.locator, n + 1, { kind: "line", enter, exit, parentKey, key });
181184 }
182185 removeDeleter(previous: MarkerState, atom: Atom): MarkerState {
Lines 187–203 at 318 (were 184–202 at 154)
184187 }
185188 removeAtom(previous: MarkerState, atom: Atom): MarkerState {
186189 this.assertContext(previous);
187− if (JSON.stringify(this.graph.atom(atom.id)) !== JSON.stringify(atom)) throw Error("canonical atom mismatch");
190+ if (!equalJsonValues(this.graph.atom(atom.id), atom)) throw Error("canonical atom mismatch");
188191 if (!this.members.get(previous.membership, atom.seq)?.present) return previous;
189192 if (required(this.members.get(previous.membership, atom.seq)).dependents)
190193 throw Error("included dependent prevents removal");
191194 return this.storage.transaction(() => {
192195 const state = { ...previous };
193− let k = 0;
194− for (const run of atom.inserts)
195− for (const text of run.lines) {
196− const marker = this.markers.get(state.locator, this.graph.lineN(`${atom.id}.${k++}`) + 1);
197− if (!marker) throw Error("missing inserted marker");
198− state.sequence = this.sequence.update(state.sequence, { kind: "visibility", id: marker.enter, delta: 1 });
199− }
196+ for (const line of this.graph.eachInsertedLine(atom.id)) {
197+ const marker = this.markers.get(state.locator, this.graph.lineN(line) + 1);
198+ if (!marker) throw Error("missing inserted marker");
199+ state.sequence = this.sequence.update(state.sequence, { kind: "visibility", id: marker.enter, delta: 1 });
200+ }
200201 for (const line of atom.deletes) {
201202 const marker = this.markers.get(state.locator, this.graph.lineN(line) + 1);
202203 if (!marker) throw Error("missing deleted marker");
MCP
compare on this site's /mcp
CLI
abso diff 154 318 src/engine/experimental/projection-marker.ts --json
JSON
/christopher/abso-core/compare/154..318?file=src%2Fengine%2Fexperimental%2Fprojection-marker.ts&format=json