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
MCP
show on this site's /mcp
CLI
abso show 59 --json
JSON
/christopher/abso-core/versions/59?format=json

The client reports an npm package's version: a build that sets ABSO_PACKAGE_VERSION gets it from abso --version and in its client header, and a built copy (the npm package or a downloaded abso.mjs) reports the installed mods without pointing at install scripts it doesn't have

of shared·pinch··Not checked

Version 58 · Files at version 59

3 files, 24 lines added, 4 removed.

--- a/client/src/client-version.ts
+++ b/client/src/client-version.ts
@@ -65,6 +65,15 @@
6565 return typeof stamp === "string" && /^[0-9a-f]{7,64}$/.test(stamp) ? stamp.slice(0, 7) : undefined;
6666}
6767
68+/** Set by the npm package build: the package's version, such as 0.58.0. Absent everywhere else. */
69+function packageVersion(): string | undefined {
70+ const stamp = (globalThis as { __ABSO_PACKAGE_VERSION__?: unknown }).__ABSO_PACKAGE_VERSION__;
71+ return typeof stamp === "string" && /^\d+\.\d+\.\d+$/.test(stamp) ? stamp : undefined;
72+}
74+/** A built copy (the npm package or a downloaded abso.mjs), which has no mods to install from, rather than a checkout. */
75+export const builtCopy = (): boolean => packageVersion() !== undefined || bundledCommit() !== undefined;
6877let version: string | undefined;
6978
7079/**
@@ -86,8 +95,9 @@
8695 }
8796}
8897
89−/** This client's version: 0.1.0+ed45dad, or plugin.json's alone outside a git checkout. */
98+/** This client's version: the npm package's (0.58.0), else 0.1.0+ed45dad, or plugin.json's alone outside a git checkout. */
9099export function clientVersion(): string {
100+ version ??= packageVersion();
91101 if (version === undefined) {
92102 let base = "0.0.0";
93103 try {
--- a/client/src/install.ts
+++ b/client/src/install.ts
@@ -45,7 +45,7 @@
4545} from "node:fs";
4646import { homedir, tmpdir } from "node:os";
4747import { dirname, join, resolve } from "node:path";
48−import { CLIENT_DIR, clientPlace, clientVersion, headCommit } from "./client-version.ts";
48+import { builtCopy, CLIENT_DIR, clientPlace, clientVersion, headCommit } from "./client-version.ts";
4949
5050export interface ModSpec {
5151 /** The mod's name, as its plugin.json has it. */
@@ -552,13 +552,16 @@
552552 })(),
553553 };
554554 mods.push(m);
555+ // A built copy has no mod files to compare with or install from: it reports what is installed.
555556 if (m.version === undefined) {
556− lines.push(`the ${m.name} mod: not installed (node client/${installer})`);
557+ lines.push(`the ${m.name} mod: not installed${builtCopy() ? "" : ` (node client/${installer})`}`);
557558 continue;
558559 }
559560 const when = m.at ? `, installed ${m.at.slice(0, 16).replace("T", " ")} UTC` : "";
560561 const behind =
561− m.version === m.current ? "" : `; this client has ${m.current}: node client/${installer} installs it`;
562+ builtCopy() || m.version === m.current
563+ ? ""
564+ : `; this client has ${m.current}: node client/${installer} installs it`;
562565 lines.push(`the ${m.name} mod: ${m.version} in ${m.folder}${when}${behind}`);
563566 }
564567 return { text: lines.join("\n"), json: { client, folder: CLIENT_DIR, mods } };
--- a/client/test/install.test.ts
+++ b/client/test/install.test.ts
@@ -490,4 +490,11 @@
490490 assert.equal(headers["x-abso-client"], `abso-cli/${clientVersion()}`);
491491 assert.match(clientVersion(), /^\d+\.\d+\.\d+(\+[0-9a-f]{7})?$/);
492492 });
494+ it("the npm package's client gives the package's version", () => {
495+ const url = new URL("../src/client-version.ts", import.meta.url).href;
496+ const script = `globalThis.__ABSO_PACKAGE_VERSION__ = "0.58.0"; const m = await import(${JSON.stringify(url)}); console.log(m.clientVersion());`;
497+ const r = spawnSync(process.execPath, ["--input-type=module", "-e", script], { encoding: "utf8" });
498+ assert.equal(r.stdout.trim(), "0.58.0", r.stderr);
499+ });
493500});