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 87 to 88

Compare

+24 −0 in 2 places
Lines 16–22 at 88 (were 16–21 at 87)
1616import { tmpdir } from "node:os";
1717import { join, resolve } from "node:path";
1818import { after, before, describe, it } from "node:test";
19+import { Api } from "../src/api.ts";
1920import { writeBox } from "../src/box.ts";
2021import { writeConfig } from "../src/config.ts";
2122import { isPublic } from "../src/join-commands.ts";
Lines 258–286 at 88 (were 257–262 at 87)
257258 assert.match(runs[0]!.stderr, /isn't signed in to .*abso login signs it in/);
258259 });
259260
261+ it("every request its Api makes goes through one send: reads only, no redirect, no sign-in", async () => {
262+ const real = globalThis.fetch;
263+ const calls: RequestInit[] = [];
264+ globalThis.fetch = (async (_input: unknown, init?: RequestInit) => {
265+ calls.push(init ?? {});
266+ return new Response("{}", { status: 200 });
267+ }) as typeof fetch;
268+ try {
269+ const visitor = new Api({ server: url, project: "abso-core", agent: "", visitor: true, token: TOKEN });
270+ await visitor.send(`${url}/p/abso-core/serve`, { headers: visitor.headers() });
271+ await assert.rejects(visitor.send(`${url}/p/abso-core/a/x/run`, { method: "POST" }), /sends only reads/);
272+ const member = new Api({ server: url, project: "abso-core", agent: "x", token: TOKEN });
273+ await member.send(`${url}/p/abso-core/serve`, { headers: member.headers() });
274+ } finally {
275+ globalThis.fetch = real;
276+ }
277+ assert.equal(calls.length, 2);
278+ assert.equal(calls[0]!.redirect, "error");
279+ assert.equal(new Headers(calls[0]!.headers).get("authorization"), null);
280+ assert.equal(calls[1]!.redirect, undefined);
281+ assert.equal(new Headers(calls[1]!.headers).get("authorization"), `Bearer ${TOKEN}`);
282+ });
260284 it("runs only its reads: every other command is refused before any call, and a new command fails here", async () => {
261285 const sorted = new Set([...Object.keys(VISITOR_READS), ...VISITOR_ELSEWHERE, ...REFUSED]);
262286 for (const name of Object.keys(commandTable()))
MCP
compare on this site's /mcp
CLI
abso diff 87 88 client/test/visitor.test.ts --json
JSON
/christopher/abso-core/compare/87..88?file=client%2Ftest%2Fvisitor.test.ts&format=json