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

Compare

+108 −4 in 6 places
Lines 26–35 at 318 (were 26–32 at 41)
2626import { clientVersion, headCommit } from "../src/client-version.ts";
2727import {
2828 AVCS_MOD,
29+ hookCommand,
30+ installerCommand,
2931 installMod,
32+ keptModCommit,
3033 type ModSpec,
3134 modsBehindText,
3235 retireOldMod,
Lines 115–142 at 318 (were 112–117 at 41)
112115 );
113116 });
114117
118+ it("stamps the command that runs this client's abso hook, where stamp.ts has a HOOK_COMMAND line", () => {
119+ const spec = source({
120+ "hooks/stamp.ts":
121+ "export const STAMP: string | undefined = undefined\nexport const HOOK_COMMAND: readonly string[] | undefined = undefined\n",
122+ });
123+ const target = join(temp(), "avcs");
124+ installMod(spec, {
125+ target,
126+ check: pass,
127+ commit: "702c616",
128+ hookCommand: ["C:\\node.exe", "C:\\abso\\client\\abso.ts", "hook"],
129+ });
130+ assert.equal(
131+ read(target, "hooks/stamp.ts"),
132+ "export const STAMP: string | undefined = '0.1.0+702c616'\n" +
133+ 'export const HOOK_COMMAND: readonly string[] | undefined = ["C:\\\\node.exe","C:\\\\abso\\\\client\\\\abso.ts","hook"]\n',
134+ );
135+ // By default, this checkout's own: the node running it and client/abso.ts.
136+ assert.deepEqual(hookCommand().slice(0, 1), [process.execPath]);
137+ assert.match(hookCommand()[1]!, /client[\\/]abso\.ts$/);
138+ });
115140 it("moves the files in by rename, what the hook imports first and plugin.json last", () => {
116141 const spec = source();
117142 const target = join(temp(), "avcs");
Lines 326–402 at 318 (were 301–306 at 41)
301326 // Outside a git checkout there is no commit to add.
302327 assert.equal(versionFor(spec, null), "0.1.0");
303328 });
330+ it("keeps the mod's commit between runs, and asks git again when the checkout or a file moves, or a file is too new to trust", {
331+ skip: !hasGit,
332+ }, () => {
333+ const spec = source();
334+ const home = temp();
335+ const kept = join(home, ".abso", "mod-commits.json");
336+ const git = (...args: string[]) =>
337+ spawnSync("git", ["-c", "user.name=t", "-c", "user.email=t@t", "-C", spec.from, ...args], {
338+ encoding: "utf8",
339+ }).stdout.trim();
340+ // Every mod file minutes old, so a kept answer can be trusted. Each call sets a whole minute earlier
341+ // than the last: git's own index compares times by the second, and a same-size edit given the time
342+ // git last saw would look unchanged to git itself.
343+ let minutes = 0;
344+ const age = () => {
345+ minutes += 1;
346+ const old = new Date(Date.now() - minutes * 60_000);
347+ for (const rel of FILES) utimesSync(at(spec.from, rel), old, old);
348+ };
349+ // Swaps every kept answer for a made-up one: what comes back says whether git ran.
350+ const plant = () => {
351+ const file = JSON.parse(readFileSync(kept, "utf8"));
352+ for (const k of Object.keys(file.mods)) file.mods[k].commit = "fffffff";
353+ writeFileSync(kept, JSON.stringify(file));
354+ };
355+ // Not a git checkout yet: no commit, and nothing kept.
356+ assert.equal(keptModCommit(spec, home), null);
357+ assert.equal(existsSync(kept), false);
358+ git("init", "-q");
359+ git("add", ".");
360+ git("commit", "-q", "-m", "mod");
361+ const mod = git("rev-parse", "--short=7", "HEAD");
362+ age();
363+ assert.equal(keptModCommit(spec, home), mod);
364+ plant();
365+ assert.equal(keptModCommit(spec, home), "fffffff", "a kept answer is used while nothing moved");
367+ // A file changed in the same moment the answer was kept is never trusted, even when its size and time match.
368+ // A time a minute ahead stays too new however long the run takes.
369+ write(spec.from, "src/core.ts", "export const core = 2\n");
370+ const soon = new Date(Date.now() + 60_000);
371+ utimesSync(at(spec.from, "src/core.ts"), soon, soon);
372+ assert.equal(keptModCommit(spec, home), `${mod}.dirty`);
373+ plant();
374+ assert.equal(keptModCommit(spec, home), `${mod}.dirty`, "too new to trust: git runs again");
376+ // An edit that keeps the size, with its time set back a minute, still isn't the time that was kept.
377+ age();
378+ assert.equal(keptModCommit(spec, home), `${mod}.dirty`);
379+ plant();
380+ write(spec.from, "src/core.ts", "export const core = 3\n");
381+ age();
382+ assert.equal(keptModCommit(spec, home), `${mod}.dirty`);
384+ // A commit moves the checkout.
385+ git("commit", "-q", "-am", "core");
386+ age();
387+ const next = git("rev-parse", "--short=7", "HEAD");
388+ assert.equal(keptModCommit(spec, home), next);
389+ plant();
390+ git("commit", "-q", "--allow-empty", "-m", "empty");
391+ assert.equal(keptModCommit(spec, home), next, "a new commit asks git again");
393+ // A file it can't read, or doesn't know the format of, is the same as none.
394+ plant();
395+ writeFileSync(kept, JSON.stringify({ format: 2, mods: JSON.parse(readFileSync(kept, "utf8")).mods }));
396+ assert.equal(keptModCommit(spec, home), next);
397+ writeFileSync(kept, "not json");
398+ assert.equal(keptModCommit(spec, home), next);
399+ });
304400});
305401
306402describe("which client this is", () => {
Lines 451–460 at 318 (were 355–363 at 41)
355451 assert.equal(client, `abso ${clientVersion()} (${dirname(import.meta.dirname)})`);
356452 assert.match(
357453 mod!,
358− /^the abso-hooks mod: 0\.1\.0\+aaaaaaa in .*skills[\\/]abso-hooks, installed 2026-10-05 04:30 UTC; this client has 0.2.0(\+[0-9a-f]{7}(\.dirty)?)?: node client\/install-mod\.ts installs it$/,
454+ /^the abso-hooks mod: 0\.1\.0\+aaaaaaa in .*skills[\\/]abso-hooks, installed 2026-10-05 04:30 UTC; this client has 0.2.0(\+[0-9a-f]{7}(\.dirty)?)?: /,
359455 );
360− assert.equal(view, "the abso-view mod: not installed (node client/install-view.ts)");
456+ assert.ok(mod!.endsWith(`: ${installerCommand("install-mod.ts")} installs it`), mod);
457+ assert.equal(view, `the abso-view mod: not installed (${installerCommand("install-view.ts")})`);
361458 const json = JSON.parse(
362459 (await main(["--version", "--json"], { cwd: config, env: { CLAUDE_CONFIG_DIR: config }, write: () => {} }))
363460 .stdout,
Lines 499–505 at 318 (were 402–408 at 41)
402499 const current = (versionReport(env).json.mods as { current: string }[])[0]!.current;
403500 if (/\+[0-9a-f]{7}$/.test(current))
404501 assert.deepEqual(modsBehindText(env), [
405− `The avcs mod installed on this machine is 0.1.0+aaaaaaa, and this client has ${current}: node client/install-mod.ts installs it (new chats load it).`,
502+ `The ${AVCS_MOD.name} mod installed on this machine is 0.1.0+aaaaaaa, and this client has ${current}: ${installerCommand("install-mod.ts")} installs it (new chats load it).`,
406503 ]);
407504 // A client outside git (an abso folder, a box) can't tell, so it says nothing.
408505 else assert.deepEqual(modsBehindText(env), []);
Lines 512–525 at 318 (were 415–421 at 41)
415512 agent: "a",
416513 token: "t",
417514 } as ConstructorParameters<typeof Api>[0]).headers("application/json");
418− assert.equal(headers["x-avcs-client"], `abso-cli/${clientVersion()}`);
515+ assert.equal(headers["x-abso-client"], `abso-cli/${clientVersion()}`);
419516 assert.match(clientVersion(), /^\d+\.\d+\.\d+(\+[0-9a-f]{7})?$/);
420517 });
519+ it("the npm package's client gives the package's version", () => {
520+ const url = new URL("../src/client-version.ts", import.meta.url).href;
521+ const script = `globalThis.__ABSO_PACKAGE_VERSION__ = "0.58.0"; const m = await import(${JSON.stringify(url)}); console.log(m.clientVersion());`;
522+ const r = spawnSync(process.execPath, ["--input-type=module", "-e", script], { encoding: "utf8" });
523+ assert.equal(r.stdout.trim(), "0.58.0", r.stderr);
524+ });
421525});
MCP
compare on this site's /mcp
CLI
abso diff 41 318 client/test/install.test.ts --json
JSON
/christopher/abso-core/compare/41..318?file=client%2Ftest%2Finstall.test.ts&format=json