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

Compare

+29 −5 in 1 place
Lines 79–116 at 318 (were 79–92 at 255)
7979 return a.length === 0 && bytes === 0 ? null : { a, b: bytes };
8080}
8181
82+/**
83+ * A laid-out file's lines by author, from its visible lines' writers (abso Capacity): each writer's author once, instead
84+ * of making an atom id and a line id for every line (an agent's tree spent 0.4 s on that for its draft's files).
85+ */
86+export function authorsInView(
87+ view: ReadView,
88+ path: string,
89+ graph: Graph,
90+ authorOf: (id: AtomId) => string,
91+): Map<string, number> {
92+ const out = new Map<string, number>();
93+ const writers = (view as { visibleWriters?(path: string): readonly number[] }).visibleWriters?.call(view, path);
94+ if (!writers) {
95+ for (const l of view.lines(path)) {
96+ const author = authorOf(l.atom);
97+ out.set(author, (out.get(author) ?? 0) + 1);
98+ }
99+ return out;
100+ }
101+ const bySeq = new Map<number, number>();
102+ for (const seq of writers) bySeq.set(seq, (bySeq.get(seq) ?? 0) + 1);
103+ for (const [seq, n] of bySeq) {
104+ const author = authorOf(graph.idOfSeq(seq));
105+ out.set(author, (out.get(author) ?? 0) + n);
106+ }
107+ return out;
108+}
82110/** A file's totals from its layout in a view, as tree with authors counts them. */
83111function laidOutTotals(view: ReadView, path: string, authorOf: (id: AtomId) => string): StoredTotals | null {
84112 if (!view.hasFile(path)) return null;
85− const authors = new Map<string, number>();
86− for (const l of view.lines(path)) {
87− const author = authorOf(l.atom);
88− authors.set(author, (authors.get(author) ?? 0) + 1);
89− }
113+ const authors = authorsInView(view, path, view.graph, authorOf);
90114 return normalTotals(authors, authors.size === 0 ? 0 : utf8Bytes(view.text(path)));
91115}
92116
MCP
compare on this site's /mcp
CLI
abso diff 255 318 worker/project/version-files.ts --json
JSON
/christopher/abso-core/compare/255..318?file=worker%2Fproject%2Fversion-files.ts&format=json