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 68 to 69

Compare

+79 −0 in 1 place
new file, 79 lines
1+// A join with no sign-in says abso login signs the box in. For a public project
2+// it also says where the website shows it, since the client needs a sign-in
3+// even to read. The client runs as its own process with an empty home, so no
4+// sign-in or token on this machine is found.
5+
6+import assert from "node:assert/strict";
7+import { execFile } from "node:child_process";
8+import { mkdtempSync, rmSync } from "node:fs";
9+import { createServer, type Server } from "node:http";
10+import type { AddressInfo } from "node:net";
11+import { tmpdir } from "node:os";
12+import { join, resolve } from "node:path";
13+import { after, before, describe, it } from "node:test";
14+import { type Fake, startFake } from "./fake-server.ts";
16+const CLIENT = resolve(import.meta.dirname, "..", "abso.ts");
17+let fake: Fake;
18+// A server where every project is public: status answers signed out, and the agent routes want a sign-in.
19+let open: Server;
20+let openUrl: string;
21+const dirs: string[] = [];
22+const temp = () => {
23+ const dir = mkdtempSync(join(tmpdir(), "abso-test-signed-out-"));
24+ dirs.push(dir);
25+ return dir;
26+};
28+before(async () => {
29+ fake = await startFake(0, "test-token-not-secret");
30+ open = createServer((req, res) => {
31+ if (req.method === "GET" && /^\/p\/[^/]+\/status$/.test(req.url ?? ""))
32+ return res.writeHead(200, { "content-type": "application/json" }).end('{"version":1,"agents":[]}');
33+ res.writeHead(401, { "content-type": "application/json" }).end('{"error":"sign in"}');
34+ });
35+ await new Promise<void>((done) => open.listen(0, "127.0.0.1", done));
36+ openUrl = `http://127.0.0.1:${(open.address() as AddressInfo).port}`;
37+});
38+after(async () => {
39+ await fake.close();
40+ open.close();
41+ for (const dir of dirs) rmSync(dir, { recursive: true, force: true });
42+});
44+/** Runs the client signed out: an empty home, and no token in the environment. */
45+function signedOut(...args: string[]): Promise<{ code: number; stderr: string }> {
46+ const home = temp();
47+ const env: Record<string, string> = {
48+ PATH: process.env.PATH ?? "",
49+ HOME: home,
50+ USERPROFILE: home,
51+ AVCS_SERVERS_FILE: "no-servers.json",
52+ };
53+ if (process.env.CLAUDE_CONFIG_DIR) env.CLAUDE_CONFIG_DIR = process.env.CLAUDE_CONFIG_DIR;
54+ if (process.env.SystemRoot) env.SystemRoot = process.env.SystemRoot;
55+ return new Promise((done) => {
56+ execFile(process.execPath, [CLIENT, ...args], { cwd: temp(), env }, (error, _stdout, stderr) =>
57+ done({ code: typeof error?.code === "number" ? error.code : 0, stderr }),
58+ );
59+ });
60+}
62+describe("join, signed out", () => {
63+ it("to a public project, as a reader, names its page on the website and abso login", async () => {
64+ const run = await signedOut("join", "abso-core", "--agent", "qa-reader", "--reader", "--server", openUrl);
65+ assert.notEqual(run.code, 0);
66+ assert.match(
67+ run.stderr,
68+ /abso-core is public: read it at http:\/\/127\.0\.0\.1:\d+\/p\/abso-core \(every page is also JSON\)\. The client needs a sign-in, even to read: abso login\./,
69+ );
70+ });
72+ it("to a project that isn't public, keeps to abso login, and says a folder with a key joins with --agent", async () => {
73+ const run = await signedOut("join", "secret", "--server", fake.url);
74+ assert.notEqual(run.code, 0);
75+ assert.match(run.stderr, /isn't signed in to .*abso login signs it in\./);
76+ assert.doesNotMatch(run.stderr, /is public/);
77+ assert.match(run.stderr, /A folder that already has a key joins with --agent <name>/);
78+ });
79+});
MCP
compare on this site's /mcp
CLI
abso diff 68 69 client/test/join-signed-out.test.ts --json
JSON
/christopher/abso-core/compare/68..69?file=client%2Ftest%2Fjoin-signed-out.test.ts&format=json