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 33 to 34

Compare

+29 −2 in 3 places
Lines 5–12 at 34 (were 5–11 at 33)
55//
66// The box credential lives in the user's config folder, one file per server,
77// never in a project folder. It is never printed, never an argument, and only
8−// ever sent to the server that issued it, on /box/ routes.
8+// ever sent to the server that issued it: on /box/ routes, and on the org reads,
9+// which answer as the person who approved the box.
1011import { createHash } from "node:crypto";
1112import { chmodSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
Lines 85–91 at 34 (were 84–90 at 33)
8485 return out;
8586}
8687
87−interface Answer {
88+export interface Answer {
8889 readonly status: number;
8990 readonly body: Record<string, unknown>;
9091}
Lines 128–159 at 34 (were 127–132 at 33)
127128 return { status: response.status, body: parsed };
128129}
129130
131+/**
132+ * A read that answers as the person who approved this box: the org reads (GET /orgs, /orgs/<name>). Answers the
133+ * status and body as they came, refusals included, so the caller can say what each means; never the credential.
134+ */
135+export async function boxGet(record: BoxRecord, path: string, fetcher: typeof fetch = fetch): Promise<Answer> {
136+ const secrets = [record.credential];
137+ let response: Response;
138+ try {
139+ response = await fetcher(`${originOf(record.server)}${path}`, {
140+ headers: { authorization: `Box ${record.credential}` },
141+ signal: AbortSignal.timeout(30_000),
142+ });
143+ } catch (err) {
144+ throw new UsageError(
145+ `couldn't reach ${originOf(record.server)}: ${scrub(err instanceof Error ? err.message : String(err), secrets)}`,
146+ );
147+ }
148+ const text = await response.text();
149+ try {
150+ const body = JSON.parse(text) as unknown;
151+ if (typeof body === "object" && body !== null && !Array.isArray(body))
152+ return { status: response.status, body: body as Record<string, unknown> };
153+ } catch {}
154+ return { status: response.status, body: { error: scrub(text.slice(0, 300), secrets) } };
155+}
130157/** This machine's name, as the server takes a box's name: 1-64 letters, digits, '.', '_' or '-'. */
131158function boxName(): string {
132159 const name = hostname()
MCP
compare on this site's /mcp
CLI
abso diff 33 34 client/src/box.ts --json
JSON
/christopher/abso-core/compare/33..34?file=client%2Fsrc%2Fbox.ts&format=json