Versions 0 to 318
Lines 7–13 at 318 (were 7–12 at 0)
77// The engine's own key, so both sides match spellings the same way (#49). Not in core.ts: the edit mod installs core.ts alone.
Lines 18–24 at 318 (were 17–23 at 0)
1819import { blobOf, keptWholeAs, MAX_BLOB_BYTES, readKnownBlobs, writeKnownBlobs } from "./blobs.ts";
20−import { AVCS_DIR, findRoot, isReader } from "./config.ts";
Lines 29–34 at 318 (were 28–34 at 0)
31− MAX_TEXT_BYTES,
Lines 42–48 at 318 (were 42–47 at 0)
4444import { applyMode, type FullMode, foldModes, onDisk, PLAIN, readKnownModes, writeKnownModes } from "./modes.ts";
4647
Lines 76–84 at 318 (were 75–80 at 0)
7778
81+
7983
Lines 87–93 at 318 (were 83–89 at 0)
86− /** Those of them new to avcs: no copy recorded before (#37, Builder 7: a file a script made is easy to miss). */
90+ /** Those of them new to avcs: no copy recorded before (#37: a file a script made is easy to miss). */
Lines 95–104 at 318 (were 91–96 at 0)
98+ /** Text files sent that hold what looks like a git conflict (a merge git left unfinished, or markers typed by hand). */
100+ /** Sent files whose path is long enough to fail on Windows, here or in another agent's folder. */
95103
96104/** The warning for text files that turned binary: what, where, and what to do. Empty when there are none. */
Lines 128–148 at 318 (were 120–125 at 0)
122130
132+ * A command that left files out for size did not do everything it was asked: say so in the exit code too, so
133+ * a script, CI or an agent cannot read "ok" while a file is missing. Other exits (refused, queued) stay as they are.
137+ const text = out.text.includes("Left out,") ? out.text : [out.text, ...leftOutText(leftOut)].join("\n");
140+ text: `${text}\nExit ${EXIT.error}: ${leftOut.length} file${leftOut.length === 1 ? " was" : "s were"} not sent.`,
145+
124147export async function uploadBlobs(api: Api, blobs: ReadonlyMap<string, BlobToSend>): Promise<void> {
Lines 215–358 at 318 (were 192–247 at 0)
194217 if (sent === 0) return { sent: 0, paths, deleted, changed: [], news: undefined, leftOut, turnedBinary };
195− await uploadBlobs(api, blobs);
196− const answer = await api.record(
197− Object.fromEntries(files),
198− {},
199− modes,
200− Object.fromEntries([...blobs].map(([rel, b]) => [rel, b.sha])),
245+ // Commit known state only after this batch is confirmed; earlier successful batches stay committed on later failure.
250+ for (const rel of new Set([...Object.keys(batch.files), ...Object.keys(batch.blobs)])) knownBlobs.delete(rel);
202− if (!answer.ok) throw new Error(`the server refused the record: ${answer.reason ?? "no reason given"}`);
203− // Forget before writing: after a rename that changes only case, known/a.ts and known/A.ts are one file on Windows and macOS.
204− for (const [rel, text] of files) if (text === null) forgetKnown(root, rel);
205− for (const [rel, text] of files) if (text !== null) writeKnown(root, rel, text);
206− const knownBlobs = readKnownBlobs(root);
207− if (blobs.size > 0 || [...files.keys()].some((rel) => knownBlobs.has(rel))) {
208− for (const rel of files.keys()) knownBlobs.delete(rel);
209− for (const [rel, b] of blobs) {
210− forgetKnown(root, rel);
211− knownBlobs.set(rel, b.sha);
212− }
213− writeKnownBlobs(root, knownBlobs);
214− }
215− const gone = [...files].filter(([, text]) => text === null).map(([rel]) => rel);
216− const knownModes = readKnownModes(root);
217− if (Object.keys(modes).length > 0 || gone.some((rel) => knownModes.has(rel))) {
218− foldModes(knownModes, modes, gone);
219− writeKnownModes(root, knownModes);
220− }
221− // Another spelling of an existing file went in as that file (#49); a new name not in composed form gets a gentle word.
222− heard(root, [
223− ...newsLines(answer.news),
224− ...(answer.spelling ?? []).map(spellingText),
225− ...(answer.uncomposed ?? []).map(uncomposedText),
226− ]);
227− return { sent, paths, deleted, added, changed: answer.changed, news: answer.news, leftOut, turnedBinary };
272+ const changed = answers.flatMap((answer) => (Array.isArray(answer.changed) ? answer.changed : []));
229312
313+/** A note per file that holds what looks like a git conflict: abso records it as it is, as text, and does not call it a collision. */
314+export function gitMarkerText(list: readonly { path: string; line: number }[] | undefined): string[] {
317+ `Note: ${m.path} has lines that look like a git conflict (from line ${m.line}). abso records them as ordinary text and will push them as they are. If a merge was left unfinished, fix the file first.`,
320+
321+/** Windows stops at 260 characters for a whole path, and another agent's folder may sit deeper than this one. */
324+
325+/** The sent files whose path will likely fail to write on Windows: the whole path is near its limit here, or the part inside the folder is already long. */
326+export function longPathsOf(root: string, paths: Iterable<string>): { path: string; length: number }[] {
332+
333+/** A note per long path: abso keeps it, but a Windows agent may not be able to write the file. */
334+export function longPathText(list: readonly { path: string; length: number }[] | undefined): string[] {
337+ `Note: ${p.path} is ${p.path.length} characters inside the folder (${p.length} with this folder's location). Windows stops at 260 for a whole path, so an agent on Windows may be unable to write it. A shorter path avoids that.`,
340+
230341/** "Recorded 3 files first: a, b, c." (names cut short past 8), or a word that the folder is paused. Empty when nothing was sent. */
232343 if (r.paused) return ["Recording is paused (abso resume): your folder's changes were not sent first."];
234− return [`Recorded first: ${recordedList(r)}.`];
345+ return [`Recorded first: ${recordedList(r)}.`, ...gitMarkerText(r.gitMarkers), ...longPathText(r.longPaths)];
236347
237−/** "2 changed (a, b), 3 deleted (x, y, z)": deletions said as such (#37, Builder 2 read its rm'd files as edits). */
348+/** "2 changed (a, b), 3 deleted (x, y, z)": deletions said as such (#37: deleted files were read as edits). */
240351 list.length <= LISTED ? list.join(", ") : `${list.slice(0, LISTED).join(", ")}, and ${list.length - LISTED} more`;
244− // New files are named in full: they are the ones a script made and nobody remembers (#37, Builder 7).
Lines 361–367 at 318 (were 250–256 at 0)
251362
253− "this folder is a reader: it records and publishes nothing (abso reader off makes it a writer again)";
364+ "this folder is a reader: it records and pushes nothing (abso reader off makes it a writer again)";
254365
Lines 380–386 at 318 (were 269–275 at 0)
272− ? "Recording again. Changes made while paused go at the next abso record (or publish, sync, ...); abso status lists them."
383+ ? "Recording again. Changes made while paused go at the next abso record (or push, pull, ...); abso status lists them."
Lines 401–427 at 318 (were 290–305 at 0)
292403 : `Recorded ${recordedList(r)}${changed === undefined ? "" : `; ${changed} changed on the server`}.`;
293− return {
294− text: [...turnedBinaryText(r.turnedBinary), text, ...leftOutText(r.leftOut)].join("\n"),
295− json: {
296− sent: r.sent,
297− changed: r.changed ?? null,
298− news: newsLines(r.news),
299− leftOut: r.leftOut,
300− turnedBinary: r.turnedBinary,
302− };
304426
Lines 432–485 at 318 (were 310–318 at 0)
313− return applyAnswer(root, api, await api.sync({ full }));
315439
441+
443+ * Whether a pull here asked the server and never wrote its answer (abso-core 26): it timed out, or stopped
444+ * partway. The server moved the agent's base when it answered, and later pulls send only what changed since
450+
452+ * Ask the server for a pull, noting first that one is under way, so a pull whose answer never gets written
453+ * leaves the note behind. With that note, or `full`, it asks for every file in the agent's view, which the
454+ * folder's own checks then write only where the folder differs. pullWritten takes the note away.
458+ writeFileAtomic(join(stateDir(root), PULLING_FILE), `${JSON.stringify({ at: new Date().toISOString() })}\n`);
468+
473+
478+ "A pull here didn't finish (its answer never arrived or wasn't written), so files may be behind this folder's base. abso pull fetches every file and writes the ones that differ.",
482+
Lines 547–553 at 318 (were 380–386 at 0)
380547/** Files earlier syncs couldn't write here, kept in .avcs/unwritten.json until a write of them works. */
383− return JSON.parse(readFileSync(join(root, AVCS_DIR, UNWRITTEN_FILE), "utf8")) as Record<string, Unwritten>;
550+ return JSON.parse(readFileSync(join(stateDir(root), UNWRITTEN_FILE), "utf8")) as Record<string, Unwritten>;
Lines 564–584 at 318 (were 397–417 at 0)
398565 const list = paths.map((p) => `${p} (version ${unwritten[p]!.version}: ${unwritten[p]!.why})`).join(", ");
400− `Stale here: a sync couldn't write ${paths.length === 1 ? "this file" : "these files"}, and no later sync sends ${paths.length === 1 ? "it" : "them"} again. Close whatever holds ${paths.length === 1 ? "it" : "them"}, then abso sync --full: ${list}`,
567+ `Stale here: a pull couldn't write ${paths.length === 1 ? "this file" : "these files"}, and no later pull sends ${paths.length === 1 ? "it" : "them"} again. Close whatever holds ${paths.length === 1 ? "it" : "them"}, then abso pull --full: ${list}`,
403570
404571/** Write the files a sync or switch answer lists into the folder (the same rules as sync). */
406573export async function applyAnswer(root: string, api: Api, unscreened: SyncAnswer): Promise<Applied> {
407− return withFolderLock(root, "sync", () => applyAnswerLocked(root, api, unscreened));
409576
410577async function applyAnswerLocked(root: string, api: Api, unscreened: SyncAnswer): Promise<Applied> {
411578 // Other agents' paths: nothing outside this folder, in .git/.claude/.avcs, or through a link.
413580 // A write the disk refuses anyway is named and skipped, so the rest of the sync still lands with its
414− // known copies and modes, rather than stopping partway (AVCS - Git Lessons; git checks every path first).
Lines 712–718 at 318 (were 545–551 at 0)
548− writeFileAtomic(join(root, AVCS_DIR, UNWRITTEN_FILE), `${JSON.stringify(unwritten, null, 1)}\n`);
715+ writeFileAtomic(join(stateDir(root), UNWRITTEN_FILE), `${JSON.stringify(unwritten, null, 1)}\n`);
- MCP
- compare on this site's /mcp
- CLI
- abso diff 0 318 client/src/commands.ts --json
- JSON
- /christopher/abso-core/compare/0..318?file=client%2Fsrc%2Fcommands.ts&format=json