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 94 to 95

Compare

+25 −3 in 4 places
Lines 2–9 at 95 (were 2–8 at 94)
22// them, and the token.
33//
44// The token is never in the folder: it comes from the ABSO_TOKEN environment
5−// variable, or else from ~/.avcs/token, outside every repo.
5+// variable, or else from ~/.avcs/token, outside every repo. A pipeline run's
6+// key comes from the file ABSO_KEY_FILE names, and is only ever held in memory.
67
78import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
89import { homedir } from "node:os";
Lines 98–111 at 95 (were 97–108 at 94)
9798 root: string,
9899 server: string,
99100 env: Readonly<Record<string, string | undefined>> = process.env,
100−): { kind: "agent key" | "shared token" | "none"; id: string | null } {
101+): { kind: "agent key" | "shared token" | "pipeline run key" | "none"; id: string | null } {
101102 const key = readKeyFile(root);
102103 if (key) {
103104 if (originOf(key.server) !== originOf(server)) return { kind: "none", id: null };
104105 return { kind: "agent key", id: key.id };
105106 }
107+ if (fromEnv(env, "TOKEN")) return { kind: "shared token", id: null };
108+ if (fromEnv(env, "KEY_FILE")) return { kind: "pipeline run key", id: null };
106109 return { kind: readToken(env) ? "shared token" : "none", id: null };
107110}
108111
Lines 187–193 at 95 (were 184–190 at 94)
184187 return key.key;
185188 }
186189 }
187− const token = readToken(env);
190+ const token = fromEnv(env, "TOKEN")?.trim() || runKey(env) || readToken(env);
188191 const trusted = trustedServers(env);
189192 if (token === undefined || tokenGoesTo(server, trusted)) return token;
190193 throw new UsageError(
Lines 216–240 at 95 (were 213–218 at 94)
213216 return trustedList(fromEnv(env, "TRUSTED_SERVERS"), readMachineServers(env));
214217}
215218
219+/**
220+ * A pipeline run's key, from the file ABSO_KEY_FILE names (the runner writes it, mode 600, holding the bare key).
221+ * Read each time and kept in memory only; nothing abso writes or prints holds it, errors included.
222+ */
223+export function runKey(env: Readonly<Record<string, string | undefined>> = process.env): string | undefined {
224+ const path = fromEnv(env, "KEY_FILE");
225+ if (!path) return undefined;
226+ let text: string;
227+ try {
228+ text = readFileSync(path, "utf8");
229+ } catch {
230+ throw new UsageError(`ABSO_KEY_FILE names ${path}, which abso can't read`);
231+ }
232+ const key = text.trim();
233+ if (!/^abso_sk_[A-Za-z0-9_-]+$/.test(key))
234+ throw new UsageError(`ABSO_KEY_FILE names ${path}, which doesn't hold an abso key`);
235+ return key;
236+}
216238/** ABSO_TOKEN if set, else ~/.abso/token, else ~/.avcs/token, else none. */
217239export function readToken(env: Readonly<Record<string, string | undefined>> = process.env): string | undefined {
218240 const fromVar = fromEnv(env, "TOKEN");
MCP
compare on this site's /mcp
CLI
abso diff 94 95 client/src/config.ts --json
JSON
/christopher/abso-core/compare/94..95?file=client%2Fsrc%2Fconfig.ts&format=json