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

Compare

+79 −22 in 18 places
Lines 10–16 at 318 (were 10–16 at 314)
1010// made when a caller asks for them, and the latest asked for is kept.
1111
1212import type { Graph, RelocationInfo } from "./graph.ts";
13−import { isStartNode, lineId, seqOf } from "./keys.ts";
13+import { atomId, isStartNode, lineId, seqOf } from "./keys.ts";
1414import { resolveScratchMoves, scratchLayoutNodes } from "./relocation-scratch.ts";
1515import { isClosedSet, StableSet } from "./state-source.ts";
1616import { joinLines } from "./text.ts";
Lines 1095–1108 at 318 (were 1095–1101 at 314)
10951095 }
10961096
10971097 *lineChunks(path: string): IterableIterator<() => Iterable<string>> {
1098− for (const n of this.#file(path).vis) yield () => this.graph.textChunks(n);
1098+ // The texts the packed layout already holds, read a page at a time (abso Capacity, 714): a record's diff read each
1099+ // line's own row, 11,873 statements for abso's index.ts. Only a line too long to pack is read in chunks.
1100+ const { vis, visText } = this.#file(path);
1101+ for (let i = 0; i < vis.length; i++) {
1102+ const packed = visText?.[i];
1103+ if (packed != null) yield () => [packed];
1104+ else yield () => this.graph.textChunks(vis[i]!);
1105+ }
10991106 }
11001107
11011108 /** Visible lines without retaining their text in the view cache. */
Lines 1112–1118 at 318 (were 1105–1111 at 314)
11051112 yield {
11061113 id: graph.lineIdOf(n),
11071114 text: graph.textOf(n),
1108− atom: graph.idOfSeq(graph.writerSeqOf(n)),
1115+ atom: atomId(graph.writerSeqOf(n)),
11091116 };
11101117 }
11111118
Lines 1126–1137 at 318 (were 1119–1130 at 314)
11191126 const n = vis[i]!;
11201127 const packed = visText?.[i];
11211128 lines[i] = {
1122− id: visWriter && visK ? lineId(graph.idOfSeq(visWriter[i]!), visK[i]!) : graph.lineIdOf(n),
1129+ id: visWriter && visK ? lineId(atomId(visWriter[i]!), visK[i]!) : graph.lineIdOf(n),
11231130 textChunks: () => graph.textChunks(n),
11241131 get text() {
11251132 return packed ?? graph.textOf(n);
11261133 },
1127− atom: graph.idOfSeq(visWriter ? visWriter[i]! : graph.writerSeqOf(n)),
1134+ atom: atomId(visWriter ? visWriter[i]! : graph.writerSeqOf(n)),
11281135 };
11291136 }
11301137 return lines;
Lines 1143–1156 at 318 (were 1136–1147 at 314)
11361143 const graph = this.graph;
11371144 const { vis, visText, visWriter, visK } = this.#file(path);
11381145 const lines: VisibleLine[] = new Array(vis.length);
1146+ // Writer seqs come from the graph's own layout, so they're named with atomId, not checked by idOfSeq (abso 738):
1147+ // on a stored graph its check read the atom count once a line, about 0.9 s of a warm draft-state on abso.
11391148 for (let i = 0; i < vis.length; i++) {
11401149 const n = vis[i]!;
11411150 lines[i] = {
1142− id: visWriter && visK ? lineId(graph.idOfSeq(visWriter[i]!), visK[i]!) : graph.lineIdOf(n),
1151+ id: visWriter && visK ? lineId(atomId(visWriter[i]!), visK[i]!) : graph.lineIdOf(n),
11431152 text: visText?.[i] ?? graph.textOf(n),
1144− atom: graph.idOfSeq(visWriter ? visWriter[i]! : graph.writerSeqOf(n)),
1153+ atom: atomId(visWriter ? visWriter[i]! : graph.writerSeqOf(n)),
11451154 };
11461155 }
11471156 this.#linesCache = { path, lines };
Lines 1172–1184 at 318 (were 1163–1175 at 314)
11631172 const writer = seqWriter ? seqWriter[i]! : graph.writerSeqOf(n);
11641173 let text: string | undefined;
11651174 out[i] = {
1166− id: seqWriter && seqK ? lineId(graph.idOfSeq(writer), seqK[i]!) : graph.lineIdOf(n),
1175+ id: seqWriter && seqK ? lineId(atomId(writer), seqK[i]!) : graph.lineIdOf(n),
11671176 get text() {
11681177 text ??= graph.textOf(n);
11691178 return text;
11701179 },
1171− atom: graph.idOfSeq(writer),
1172− deletedBy: by ? by.map((s) => graph.idOfSeq(s)) : NONE,
1180+ atom: atomId(writer),
1181+ deletedBy: by ? by.map((s) => atomId(s)) : NONE,
11731182 visible: by === undefined,
11741183 };
11751184 }
Lines 68–74 at 318 (were 68–74 at 314)
6868 }
6969 for (const key of claimsOf(atom)) streams.push(g.eachWriterOf(key));
7070 const theirs: AtomId[] = [];
71− for (const id of orderedClaimants(g, streams)) if (against.has(id)) theirs.push(id);
71+ for (const id of orderedClaimants(streams)) if (against.has(id)) theirs.push(id);
7272 out.set(yours, theirs);
7373 }
7474 return out;
Lines 136–142 at 318 (were 136–142 at 314)
136136
137137/** Claim indexes append in canonical seq order. Merge one cursor per current
138138 * atom key, retaining no candidate set proportional to historical claims. */
139−function* orderedClaimants(g: Graph, streams: IterableIterator<AtomId>[]): IterableIterator<AtomId> {
139+function* orderedClaimants(streams: IterableIterator<AtomId>[]): IterableIterator<AtomId> {
140140 try {
141141 type Head = { id: AtomId; seq: number; stream: number };
142142 const heap: Head[] = [];
Lines 152–162 at 318 (were 152–160 at 314)
152152 }
153153 heap[at] = head;
154154 };
155+ // Each claimant's seq from its id, as the graph reads it (abso 738): loading the stored atom for it read a row a
156+ // claimant, most of a warm draft-state's pairing on abso.
155157 const advance = (stream: number) => {
156158 const next = streams[stream]!.next();
157− if (!next.done) push({ id: next.value, seq: g.atom(next.value).seq, stream });
159+ if (!next.done) push({ id: next.value, seq: seqOf(next.value), stream });
158160 };
159161 for (let stream = 0; stream < streams.length; stream++) advance(stream);
160162 let previous = -1;
Lines 192–199 at 318 (were 190–197 at 314)
190192 let a = left.next();
191193 let b = right.next();
192194 while (!a.done && !b.done) {
193− const x = g.atom(a.value).seq;
194− const y = g.atom(b.value).seq;
195+ const x = seqOf(a.value);
196+ const y = seqOf(b.value);
195197 if (x === y && settled.has(a.value)) return true;
196198 if (x <= y) a = left.next();
197199 if (y <= x) b = right.next();
Lines 125–135 at 318 (were 125–130 at 314)
125125 spaceName: string,
126126 kept?: { parts: KeptParts; uses: string; changed: string },
127127 names?: ReadonlySet<string>,
128+ /**
129+ * The files the newer work changed, when the caller knows them without placing its lines (land and draft-state:
130+ * shared's kept version files, abso 738); undefined, or one that answers undefined, and they're worked out here.
131+ */
132+ changedFiles?: () => ReadonlySet<string> | undefined,
128133 ): DefinitionCollision[] {
129134 if (draft.size === 0 || newer.size === 0) return [];
130135 const uses = kept
Lines 158–168 at 318 (were 153–161 at 314)
153158 // Only a file the newer work touched can hold a changed definition, and only one a use means can matter: just those
154159 // files are laid out, before and with the newer work (abso 738). Laying out every file the newer work touched cost
155160 // codex-prose-authorship-610's draft-state 494 files a view where its uses reach 7.
156− const touched = kept
157− ? kept.parts.get(`touched ${kept.changed}`, () => this.#touched(newer, baseView, nowOf()), filesBytes)
158− : this.#touchedFor(newer, baseView, nowOf());
161+ const touched =
162+ changedFiles?.() ??
163+ (kept
164+ ? kept.parts.get(`touched ${kept.changed}`, () => this.#touched(newer, baseView, nowOf()), filesBytes)
165+ : this.#touchedFor(newer, baseView, nowOf()));
159166 const changed = new Map<string, Changed>();
160167 const changedIn = (file: string): Changed => {
161168 let c = changed.get(file);
Lines 29–36 at 318 (were 29–34 at 314)
2929 pairs(draft: readonly AtomId[], against: ReadonlySet<AtomId>, settled: ReadonlySet<AtomId>): Pair[];
3030 describe(pair: Pair, yoursView: ReadView, theirsView: ReadView, spaceName: string): Collision;
3131 definitionRule(): DefinitionRule;
32+ /** The files a space's versions after `from`, up to `to`, changed, when each one's are kept; else undefined. */
33+ changedSince(space: Space, from: number, to: number): ReadonlySet<string> | undefined;
3234 refuse(
3335 agent: AgentState,
3436 space: Space,
Lines 95–118 at 318 (were 93–103 at 314)
9395 ? host.viewAt(shared, sharedBaseOf(space), changes)
9496 : host.viewAt(space, space.versions.length - 1);
9597 const describeLand = (p: Pair): Collision => host.describe(p, draftView, host.sharedView(), SHARED);
98+ // Where shared changed since the draft's base, from the files each version since kept as it landed (abso 738): working
99+ // it out from the newer atoms placed every line they wrote or deleted, about 30% of a warm draft-state read.
100+ const changed = () => host.changedSince(shared, sharedBaseOf(space), host.version());
96101 const collisions = [
97102 ...host.pairs(changes, newer, union).map(describeLand),
98103 ...host
99104 .definitionRule()
100− .collisions(own, draftView, host.viewAt(shared, sharedBaseOf(space)), host.sharedView(), newer, SHARED)
105+ .collisions(
106+ own,
107+ draftView,
108+ host.viewAt(shared, sharedBaseOf(space)),
109+ host.sharedView(),
110+ newer,
111+ SHARED,
112+ undefined,
113+ undefined,
114+ changed,
115+ )
101116 .map((d) => d.collision),
102117 ];
103118 return { collisions, newer, union };
Lines 90–110 at 318 (were 90–95 at 314)
9090 return files && [...files].sort();
9191 }
9292
93+ /**
94+ * The files the versions after `from`, up to `to`, changed, from each version's kept row (abso 738): undefined when one
95+ * has none, and the caller works them out from the atoms. Every file whose text differs between the two versions is
96+ * in it, since some version between changed it.
97+ */
98+ keptChangesSince(space: Space, from: number, to: number): ReadonlySet<string> | undefined {
99+ const out = new Set<string>();
100+ for (let v = from + 1; v <= to; v++) {
101+ const files = this.#keptFiles(space, v);
102+ if (!files) return undefined;
103+ for (const f of files) out.add(f);
104+ }
105+ return out;
106+ }
93108 /** keptPaths as a set, kept for the newest version asked: never changed once made, so a view can hold it. */
94109 keptPathSet(space: Space, version: number): ReadonlySet<string> | undefined {
95110 let fold = this.#keptPaths.get(space);
Lines 2499–2507 at 318 (were 2499–2504 at 314)
24992499 pairs: (draft, against, settled) => this.#pairs(draft, against, settled),
25002500 describe: (pair, yoursView, theirsView, spaceName) => this.#describe(pair, yoursView, theirsView, spaceName),
25012501 definitionRule: () => this.#definitionRule,
2502+ // Only from a stored writer's kept rows, as keptPaths: a project in memory keeps none, and works them out.
2503+ changedSince: (space, from, to) =>
2504+ this.#writerStorage ? this.#paths.keptChangesSince(space, from, to) : undefined,
25022505 refuse: (agent, space, via, time, collisions, entries) =>
25032506 this.#refuse(agent, space, via, time, collisions, entries),
25042507 requireClosed: (tie, union) => this.#requireClosed(tie, union),
Lines 3218–3236 at 318 (were 3215–3229 at 314)
32153218 const base = agent.mine.some((id) => at.has(id))
32163219 ? this.#view(differenceSet(at, new StableOverlaySet(agent.mine)))
32173220 : this.#viewAt(space, agent.base);
3221+ const to = version ?? last(space);
32183222 return this.#definitionRule.collisions(
32193223 draft,
32203224 this.#agentView(agent),
32213225 base,
3222− this.#viewAt(space, version ?? last(space)),
3226+ this.#viewAt(space, to),
32233227 newer,
32243228 space.name,
32253229 undefined,
32263230 names,
3231+ // Where the space changed since the agent's base, from each version's kept files on a stored writer, as land's
3232+ // (abso 714): walking every newer atom for them was 6.5 s of a publish 770 versions behind on abso.
3233+ () => (this.#writerStorage ? this.#paths.keptChangesSince(space, agent.base, to) : undefined),
32273234 );
32283235 }
32293236}
Lines 73–81 at 318 (were 73–79 at 314)
7373export function spellingOf(view: ReadView, path: string): string {
7474 if (view.hasFile(path)) return path;
7575 const key = pathKey(path);
76− // Known paths first, by key, then only those laid out (#46).
77− const twins = view.knownPaths().filter((p) => pathKey(p) === key && view.hasFile(p));
76+ // Every path the graph has ever had, by key, then only those the view has a file at (#46). Not the view's known paths
77+ // (abso Capacity, 714): those read every atom's membership and file list, 36,360 statements of a record on abso, as
78+ // clashIn found. A path the view never had has no file in it, so the answers are the same.
79+ const twins = [...view.graph.knownFiles()].filter((p) => pathKey(p) === key && view.hasFile(p));
7880 return twins.length === 1 ? twins[0]! : path;
7981}
MCP
compare on this site's /mcp
CLI
abso diff 314 318 --json
JSON
/christopher/abso-core/compare/314..318?format=json