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 16 to 17

Compare

+24 −14 in 9 places
Lines 173–181 at 17 (were 173–181 at 16)
173173 let outcome: string;
174174 let news: readonly string[] = [];
175175 try {
176− if ((await readOr($, `${job.root}/.avcs/paused`)) !== undefined) {
176+ if ((await readOr($, `${await stateOf($, job.root)}/paused`)) !== undefined) {
177177 outcome = "skipped: recording is paused (abso resume)";
178− } else if (/"reader"\s*:\s*true/.test((await readOr($, `${job.root}/.avcs/config.json`)) ?? "")) {
178+ } else if (/"reader"\s*:\s*true/.test((await readOr($, `${await stateOf($, job.root)}/config.json`)) ?? "")) {
179179 outcome = "skipped: this folder is a reader";
180180 } else if (await ignored($, job.root, job.rel)) {
181181 outcome = "skipped: ignored path";
Lines 189–195 at 17 (were 189–195 at 16)
189189 }
190190 } catch (err) {
191191 outcome = `error: ${(err as Error).message}`;
192− await $.fs.write(`${job.root}/.avcs/known/${job.rel}`, FORGOTTEN).catch(() => {});
192+ await $.fs.write(`${await stateOf($, job.root)}/known/${job.rel}`, FORGOTTEN).catch(() => {});
193193 }
194194 const done = await $.clock.now().catch(() => started);
195195 await log(
Lines 217–223 at 17 (were 217–223 at 16)
217217/** Ask for the news waiting for this agent (announcements, collisions) and hand it to the model. */
218218async function pollNews($: Engine, root: string): Promise<void> {
219219 try {
220− const config = JSON.parse(await $.fs.read(`${root}/.avcs/config.json`)) as {
220+ const config = JSON.parse(await $.fs.read(`${await stateOf($, root)}/config.json`)) as {
221221 server: string;
222222 project: string;
223223 agent: string;
Lines 263–281 at 17 (were 263–271 at 16)
263263 }
264264}
265265
266+/** A folder's state folder: .abso, or .avcs in a folder from before the rename. (A mod can't import the client's state-dir.ts.) */
267+async function stateOf($: Engine, root: string): Promise<string> {
268+ return (await $.fs.exists(`${root}/.abso/config.json`)) ? `${root}/.abso` : `${root}/.avcs`;
269+}
271+/** A file under the user's home: ~/.abso/<name>, else the older ~/.avcs/<name>. */
272+async function readHome($: Engine, home: string, name: string): Promise<string | undefined> {
273+ return (await readOr($, `${slash(home)}/.abso/${name}`)) ?? (await readOr($, `${slash(home)}/.avcs/${name}`));
274+}
266276/** Whether the server has this path as a symbolic link (.avcs/modes.json, written by the client). */
267277async function isLink($: Engine, root: string, rel: string): Promise<boolean> {
268− const raw = await readOr($, `${root}/.avcs/modes.json`);
278+ const raw = await readOr($, `${await stateOf($, root)}/modes.json`);
269279 if (raw === undefined) return false;
270280 try {
271281 const modes = JSON.parse(raw) as Record<string, { link?: unknown }>;
Lines 303–309 at 17 (were 293–299 at 16)
293303 return makeIgnore((f) => files.get(f), setup.git)(rel, false);
294304}
295305
296−/** The nearest folder above the file that has .avcs/config.json, cached per folder. */
306+/** The nearest folder above the file that has .abso/config.json (or .avcs/config.json from before the rename), cached per folder. */
297307async function findRoot($: Engine, path: string): Promise<string | undefined> {
298308 const start = path.slice(0, path.lastIndexOf("/"));
299309 const now = await $.clock.now();
Lines 312–318 at 17 (were 302–308 at 16)
302312 let found: string | undefined;
303313 let dir = start;
304314 while (dir.includes("/")) {
305− if (await $.fs.exists(`${dir}/.avcs/config.json`)) {
315+ if ((await $.fs.exists(`${dir}/.abso/config.json`)) || (await $.fs.exists(`${dir}/.avcs/config.json`))) {
306316 found = dir;
307317 break;
308318 }
Lines 324–346 at 17 (were 314–336 at 16)
314324 return found;
315325}
316326
317−/** AVCS_TOKEN if set, else ~/.avcs/token; none for a server the token may not go to (core.ts tokenGoesTo, with this machine's servers.json). */
327+/** AVCS_TOKEN if set, else ~/.abso/token, else ~/.avcs/token; none for a server the token may not go to (core.ts tokenGoesTo, with this machine's servers.json). */
318328async function token($: Engine, server: string): Promise<string | undefined> {
319329 const home = (await $.env.get("USERPROFILE")) ?? (await $.env.get("HOME"));
320− const machine = machineServers(home ? await readOr($, `${slash(home)}/.avcs/servers.json`) : undefined);
330+ const machine = machineServers(home ? await readHome($, home, "servers.json") : undefined);
321331 if (!tokenGoesTo(server, trustedList(await $.env.get("AVCS_TRUSTED_SERVERS"), machine))) return undefined;
322332 const env = await $.env.get("AVCS_TOKEN");
323333 if (env) return env.trim();
324− return home ? (await readOr($, `${slash(home)}/.avcs/token`))?.trim() || undefined : undefined;
334+ return home ? (await readHome($, home, "token"))?.trim() || undefined : undefined;
325335}
326336
327337async function send($: Engine, job: Job, who: Who): Promise<{ outcome: string; news: readonly string[] }> {
328338 const { root, rel } = job;
329339 // While an abso command changes the folder's records, leave the known copy alone: the next record sends the file (#51).
330− if (lockHeld(await readOr($, `${root}/.avcs/${LOCK_FILE}`), Date.now()))
340+ if (lockHeld(await readOr($, `${await stateOf($, root)}/${LOCK_FILE}`), Date.now()))
331341 return { outcome: "skipped: another abso command is changing this folder; abso record sends it", news: [] };
332342 const disk = job.snapshot;
333− const knownPath = `${root}/.avcs/known/${rel}`;
343+ const knownPath = `${await stateOf($, root)}/known/${rel}`;
334344 const knownRaw = await readOr($, knownPath);
335345 if (disk === undefined) {
336346 if (job.nul !== undefined && knownRaw !== undefined && !looksBinary(knownRaw)) {
Lines 352–358 at 17 (were 342–348 at 16)
342352 }
343353 const known = knownRaw === undefined || looksBinary(knownRaw) ? undefined : knownRaw;
344354
345− const config = JSON.parse(await $.fs.read(`${root}/.avcs/config.json`)) as {
355+ const config = JSON.parse(await $.fs.read(`${await stateOf($, root)}/config.json`)) as {
346356 server: string;
347357 project: string;
348358 agent: string;
Lines 396–402 at 17 (were 386–392 at 16)
386396/** One line per edit in .avcs/hook.log (or another log there), as the command hook writes, kept under LOG_LIMIT. */
387397async function log($: Engine, root: string, line: string, file = "hook.log"): Promise<void> {
388398 try {
389− const path = `${root}/.avcs/${file}`;
399+ const path = `${await stateOf($, root)}/${file}`;
390400 let text = `${(await readOr($, path)) ?? ""}${line}\n`;
391401 if (text.length > LOG_LIMIT) text = text.slice(text.indexOf("\n", text.length - LOG_LIMIT / 2) + 1);
392402 await $.fs.write(path, text);
MCP
compare on this site's /mcp
CLI
abso diff 16 17 client/hooks/register.ts --json
JSON
/christopher/abso-core/compare/16..17?file=client%2Fhooks%2Fregister.ts&format=json