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

+13 −16 in 4 places
Lines 8–18 at 17 (were 8–17 at 16)
88// ever sent to the server that issued it, on /box/ routes.
99
1010import { createHash } from "node:crypto";
11−import { chmodSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
11+import { chmodSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
1212import { homedir, hostname } from "node:os";
13−import { join } from "node:path";
13+import { dirname, join } from "node:path";
1414import { UsageError } from "./args.ts";
15+import { homeFile, homeWritePath, OLD_STATE_DIR } from "./state-dir.ts";
1516
1617/** What the person who approved the code allowed: each project with the highest role its agents get there, and how many agents. */
1718export interface Grant {
Lines 36–48 at 17 (were 35–48 at 16)
3536 }
3637}
3738
38−function boxPath(server: string, home: string): string {
39− const name = createHash("sha256").update(originOf(server)).digest("hex").slice(0, 16);
40− return join(home, ".avcs", "boxes", `${name}.json`);
39+function boxFile(server: string): string {
40+ return `${createHash("sha256").update(originOf(server)).digest("hex").slice(0, 16)}.json`;
4141}
4242
4343export function readBox(server: string, home = homedir()): BoxRecord | undefined {
4444 try {
45− const raw = JSON.parse(readFileSync(boxPath(server, home), "utf8")) as Partial<BoxRecord>;
45+ const raw = JSON.parse(readFileSync(homeFile(home, "boxes", boxFile(server)), "utf8")) as Partial<BoxRecord>;
4646 if (
4747 typeof raw.server !== "string" ||
4848 originOf(raw.server) !== originOf(server) ||
Lines 59–66 at 17 (were 59–66 at 16)
5959}
6060
6161export function writeBox(record: BoxRecord, home = homedir()): void {
62− const path = boxPath(record.server, home);
63− mkdirSync(join(home, ".avcs", "boxes"), { recursive: true });
62+ const path = homeWritePath(home, "boxes", boxFile(record.server));
63+ mkdirSync(dirname(path), { recursive: true });
6464 writeFileSync(path, `${JSON.stringify(record)}\n`, { mode: 0o600 });
6565 try {
6666 chmodSync(path, 0o600);
Lines 69–80 at 17 (were 69–83 at 16)
6969 }
7070}
7171
72+/** Logout ends the sign-in everywhere on this machine: the credential under ~/.abso and any older copy under ~/.avcs. */
7273export function forgetBox(server: string, home = homedir()): boolean {
73− const path = boxPath(server, home);
74− try {
75− readFileSync(path);
76− } catch {
77− return false;
78− }
79− rmSync(path, { force: true });
80− return true;
74+ const paths = [homeWritePath(home, "boxes", boxFile(server)), join(home, OLD_STATE_DIR, "boxes", boxFile(server))];
75+ const had = paths.filter((path) => existsSync(path));
76+ for (const path of had) rmSync(path, { force: true });
77+ return had.length > 0;
8178}
8279
8380/** Error text with the credential (and anything shaped like a key) taken out. */
MCP
compare on this site's /mcp
CLI
abso diff 16 17 client/src/box.ts --json
JSON
/christopher/abso-core/compare/16..17?file=client%2Fsrc%2Fbox.ts&format=json