{"draft":null,"from":16,"to":17,"files":[{"path":"client/hooks/register.ts","added":24,"removed":14,"diff":"--- a/client/hooks/register.ts\n+++ b/client/hooks/register.ts\n@@ -173,9 +173,9 @@\n \tlet outcome: string;\n \tlet news: readonly string[] = [];\n \ttry {\n-\t\tif ((await readOr($, `${job.root}/.avcs/paused`)) !== undefined) {\n+\t\tif ((await readOr($, `${await stateOf($, job.root)}/paused`)) !== undefined) {\n \t\t\toutcome = \"skipped: recording is paused (abso resume)\";\n-\t\t} else if (/\"reader\"\\s*:\\s*true/.test((await readOr($, `${job.root}/.avcs/config.json`)) ?? \"\")) {\n+\t\t} else if (/\"reader\"\\s*:\\s*true/.test((await readOr($, `${await stateOf($, job.root)}/config.json`)) ?? \"\")) {\n \t\t\toutcome = \"skipped: this folder is a reader\";\n \t\t} else if (await ignored($, job.root, job.rel)) {\n \t\t\toutcome = \"skipped: ignored path\";\n@@ -189,7 +189,7 @@\n \t\t}\n \t} catch (err) {\n \t\toutcome = `error: ${(err as Error).message}`;\n-\t\tawait $.fs.write(`${job.root}/.avcs/known/${job.rel}`, FORGOTTEN).catch(() => {});\n+\t\tawait $.fs.write(`${await stateOf($, job.root)}/known/${job.rel}`, FORGOTTEN).catch(() => {});\n \t}\n \tconst done = await $.clock.now().catch(() => started);\n \tawait log(\n@@ -217,7 +217,7 @@\n /** Ask for the news waiting for this agent (announcements, collisions) and hand it to the model. */\n async function pollNews($: Engine, root: string): Promise<void> {\n \ttry {\n-\t\tconst config = JSON.parse(await $.fs.read(`${root}/.avcs/config.json`)) as {\n+\t\tconst config = JSON.parse(await $.fs.read(`${await stateOf($, root)}/config.json`)) as {\n \t\t\tserver: string;\n \t\t\tproject: string;\n \t\t\tagent: string;\n@@ -263,9 +263,19 @@\n \t}\n }\n \n+/** 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.) */\n+async function stateOf($: Engine, root: string): Promise<string> {\n+\treturn (await $.fs.exists(`${root}/.abso/config.json`)) ? `${root}/.abso` : `${root}/.avcs`;\n+}\n+\n+/** A file under the user's home: ~/.abso/<name>, else the older ~/.avcs/<name>. */\n+async function readHome($: Engine, home: string, name: string): Promise<string | undefined> {\n+\treturn (await readOr($, `${slash(home)}/.abso/${name}`)) ?? (await readOr($, `${slash(home)}/.avcs/${name}`));\n+}\n+\n /** Whether the server has this path as a symbolic link (.avcs/modes.json, written by the client). */\n async function isLink($: Engine, root: string, rel: string): Promise<boolean> {\n-\tconst raw = await readOr($, `${root}/.avcs/modes.json`);\n+\tconst raw = await readOr($, `${await stateOf($, root)}/modes.json`);\n \tif (raw === undefined) return false;\n \ttry {\n \t\tconst modes = JSON.parse(raw) as Record<string, { link?: unknown }>;\n@@ -293,7 +303,7 @@\n \treturn makeIgnore((f) => files.get(f), setup.git)(rel, false);\n }\n \n-/** The nearest folder above the file that has .avcs/config.json, cached per folder. */\n+/** The nearest folder above the file that has .abso/config.json (or .avcs/config.json from before the rename), cached per folder. */\n async function findRoot($: Engine, path: string): Promise<string | undefined> {\n \tconst start = path.slice(0, path.lastIndexOf(\"/\"));\n \tconst now = await $.clock.now();\n@@ -302,7 +312,7 @@\n \tlet found: string | undefined;\n \tlet dir = start;\n \twhile (dir.includes(\"/\")) {\n-\t\tif (await $.fs.exists(`${dir}/.avcs/config.json`)) {\n+\t\tif ((await $.fs.exists(`${dir}/.abso/config.json`)) || (await $.fs.exists(`${dir}/.avcs/config.json`))) {\n \t\t\tfound = dir;\n \t\t\tbreak;\n \t\t}\n@@ -314,23 +324,23 @@\n \treturn found;\n }\n \n-/** 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). */\n+/** 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). */\n async function token($: Engine, server: string): Promise<string | undefined> {\n \tconst home = (await $.env.get(\"USERPROFILE\")) ?? (await $.env.get(\"HOME\"));\n-\tconst machine = machineServers(home ? await readOr($, `${slash(home)}/.avcs/servers.json`) : undefined);\n+\tconst machine = machineServers(home ? await readHome($, home, \"servers.json\") : undefined);\n \tif (!tokenGoesTo(server, trustedList(await $.env.get(\"AVCS_TRUSTED_SERVERS\"), machine))) return undefined;\n \tconst env = await $.env.get(\"AVCS_TOKEN\");\n \tif (env) return env.trim();\n-\treturn home ? (await readOr($, `${slash(home)}/.avcs/token`))?.trim() || undefined : undefined;\n+\treturn home ? (await readHome($, home, \"token\"))?.trim() || undefined : undefined;\n }\n \n async function send($: Engine, job: Job, who: Who): Promise<{ outcome: string; news: readonly string[] }> {\n \tconst { root, rel } = job;\n \t// While an abso command changes the folder's records, leave the known copy alone: the next record sends the file (#51).\n-\tif (lockHeld(await readOr($, `${root}/.avcs/${LOCK_FILE}`), Date.now()))\n+\tif (lockHeld(await readOr($, `${await stateOf($, root)}/${LOCK_FILE}`), Date.now()))\n \t\treturn { outcome: \"skipped: another abso command is changing this folder; abso record sends it\", news: [] };\n \tconst disk = job.snapshot;\n-\tconst knownPath = `${root}/.avcs/known/${rel}`;\n+\tconst knownPath = `${await stateOf($, root)}/known/${rel}`;\n \tconst knownRaw = await readOr($, knownPath);\n \tif (disk === undefined) {\n \t\tif (job.nul !== undefined && knownRaw !== undefined && !looksBinary(knownRaw)) {\n@@ -342,7 +352,7 @@\n \t}\n \tconst known = knownRaw === undefined || looksBinary(knownRaw) ? undefined : knownRaw;\n \n-\tconst config = JSON.parse(await $.fs.read(`${root}/.avcs/config.json`)) as {\n+\tconst config = JSON.parse(await $.fs.read(`${await stateOf($, root)}/config.json`)) as {\n \t\tserver: string;\n \t\tproject: string;\n \t\tagent: string;\n@@ -386,7 +396,7 @@\n /** One line per edit in .avcs/hook.log (or another log there), as the command hook writes, kept under LOG_LIMIT. */\n async function log($: Engine, root: string, line: string, file = \"hook.log\"): Promise<void> {\n \ttry {\n-\t\tconst path = `${root}/.avcs/${file}`;\n+\t\tconst path = `${await stateOf($, root)}/${file}`;\n \t\tlet text = `${(await readOr($, path)) ?? \"\"}${line}\\n`;\n \t\tif (text.length > LOG_LIMIT) text = text.slice(text.indexOf(\"\\n\", text.length - LOG_LIMIT / 2) + 1);\n \t\tawait $.fs.write(path, text);"}],"unmatched":[]}