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

+14 −9 in 10 places
Lines 23–33 at 143 (were 23–28 at 142)
2323} from "./types.ts";
2424import { View } from "./view.ts";
2525
26+/** Exact read surface used to build atoms; membership requires point lookup only. */
27+export type AtomBuildView = Pick<View, "graph" | "lines" | "sequence" | "sequenceIndex" | "parentOf"> & {
28+ readonly set: Pick<ReadonlySet<AtomId>, "has">;
29+};
2631/** Replace the one exact occurrence of `old` in `file` with `new`. */
2732export interface TextEdit {
2833 readonly file: string;
Lines 113–119 at 143 (were 108–114 at 142)
108113 * the graph's next id; accept it with `graph.add(atom)` and put it in a set.
109114 * Its dependencies are derived from what it touched in the view (see deriveDeps).
110115 */
111−export function buildAtom(view: View, input: AtomInput): Atom {
116+export function buildAtom(view: AtomBuildView, input: AtomInput): Atom {
112117 return build(view, input, false);
113118}
114119
Lines 131–137 at 143 (were 126–132 at 142)
126131 return build(view, { ...meta, edits, attrs }, true);
127132}
128133
129−function build(view: View, input: AtomInput, allowEmpty: boolean): Atom {
134+function build(view: AtomBuildView, input: AtomInput, allowEmpty: boolean): Atom {
130135 const graph = view.graph;
131136 const id = graph.nextId();
132137 if (typeof input.author !== "string" || typeof input.message !== "string") {
Lines 280–286 at 143 (were 275–281 at 142)
275280 * lines into each other collide in all but the rarest cases (the view breaks
276281 * any loop that is left).
277282 */
278−function planMove(view: View, move: MoveInput, writes: Set<Key>, reads: Set<Key>): Relocation[] {
283+function planMove(view: AtomBuildView, move: MoveInput, writes: Set<Key>, reads: Set<Key>): Relocation[] {
279284 for (const path of [move.file, move.to]) {
280285 if (typeof path !== "string" || path === "" || /[\n\r]/.test(path))
281286 throw new EngineError("bad-edit", `bad file path ${JSON.stringify(path)}`);
Lines 346–352 at 143 (were 341–347 at 142)
341346 * the semantic contract. A missing tip still implies its required ancestors.
342347 */
343348function deriveDeps(
344− view: View,
349+ view: AtomBuildView,
345350 parts: {
346351 writes: readonly Key[];
347352 reads: readonly Key[];
Lines 395–401 at 143 (were 390–396 at 142)
390395 });
391396}
392397
393−function rangeLines(view: View, range: LineRange): LineId[] {
398+function rangeLines(view: AtomBuildView, range: LineRange): LineId[] {
394399 const visible = view.lines(range.file);
395400 if (
396401 !Number.isInteger(range.start) ||
Lines 412–418 at 143 (were 407–413 at 142)
407412 return visible.slice(range.start, range.end).map((l) => l.id);
408413}
409414
410−function uniqueAtoms(view: View, ids: readonly AtomId[], what: string): AtomId[] {
415+function uniqueAtoms(view: AtomBuildView, ids: readonly AtomId[], what: string): AtomId[] {
411416 const out: AtomId[] = [];
412417 for (const id of ids) {
413418 if (!view.graph.has(id)) throw new EngineError("unknown-atom", `${what} names unknown atom ${id}`);
Lines 424–430 at 143 (were 419–425 at 142)
419424
420425// Matching edits ---------------------------------------------------------------
421426
422−function resolveRegions(view: View, edits: readonly EditInput[]): Region[] {
427+function resolveRegions(view: AtomBuildView, edits: readonly EditInput[]): Region[] {
423428 const regions = edits.map((edit, order) => {
424429 const mode = edit.mode ?? "both";
425430 if (!MODES.includes(mode)) throw new EngineError("bad-edit", `mode must be one of ${MODES.join(", ")}`);
Lines 460–466 at 143 (were 455–461 at 142)
455460 * whole lines. If the replacement would leave a line without its newline, the
456461 * next line joins the region (that is what the plain-text edit does).
457462 */
458−function matchText(view: View, edit: TextEdit, mode: Mode, order: number): Region {
463+function matchText(view: AtomBuildView, edit: TextEdit, mode: Mode, order: number): Region {
459464 if (typeof edit.old !== "string" || typeof edit.new !== "string") {
460465 throw new EngineError("bad-edit", "a text edit needs old and new strings");
461466 }
Lines 519–525 at 143 (were 514–520 at 142)
514519 return { file, start: startLine, end: endLine + 1, lines: splitLines(replacement), mode, order };
515520}
516521
517−function matchSplice(view: View, edit: SpliceEdit, mode: Mode, order: number): Region {
522+function matchSplice(view: AtomBuildView, edit: SpliceEdit, mode: Mode, order: number): Region {
518523 const count = view.lines(edit.file).length;
519524 if (
520525 !Number.isInteger(edit.start) ||
MCP
compare on this site's /mcp
CLI
abso diff 142 143 src/engine/build.ts --json
JSON
/christopher/abso-core/compare/142..143?file=src%2Fengine%2Fbuild.ts&format=json