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 7 to 318

Compare

+29 −27 in 10 places
Lines 6–15 at 318 (were 6–14 at 7)
66import { boxOf, runRun, shellWord, undoGitBashPaths } from "./box-commands.ts";
77import { type Env, EXIT, type Output, open } from "./command-env.ts";
88import { fetchedText, fetchFromBox } from "./fetch.ts";
9+import { stateDir } from "./state-dir.ts";
910import { untarGz } from "./tar.ts";
1011
11−/** abso serve [--version N]: a preview of one version of shared at a stable URL, built once on the server (#37, Playtester 1). */
12+/** abso serve [--version N]: a preview of one version of shared at a stable URL, built once on the server (#37). */
1213export async function runServe(args: Parsed, env: Env): Promise<Output> {
1314 const raw = str(args, "version");
1415 if (raw !== undefined && !/^\d+$/.test(raw))
Lines 17–23 at 318 (were 16–22 at 7)
1617 const { api } = open(env);
1718 if (raw === undefined)
1819 (env.writeErr ?? env.write)(
19− "avcs: building a preview of the newest version of shared (once per version; a minute the first time)…\n",
20+ "abso: building a preview of the newest version of shared (once per version; a minute the first time)…\n",
2021 );
2122 const s = await api.serve(raw === undefined ? undefined : Number(raw), str(args, "build"), str(args, "out"));
2223 if (!s.built || !s.url) {
Lines 37–51 at 318 (were 36–50 at 7)
3637}
3738
3839/**
39− * The script abso shot runs in the box (from /w/.avcs-shot, so 'playwright' is
40− * the project's own). It reads its setup from AVCS_SHOT and prints marked
41− * lines the client picks out: AVCS_SHOT_IMAGE {json}, blocks between
42− * AVCS_SHOT_BEGIN <name> and AVCS_SHOT_END, and "eval: ", "page error: ",
40+ * The script abso shot runs in the box (from /w/.abso-shot, so 'playwright' is
41+ * the project's own). It reads its setup from ABSO_SHOT and prints marked
42+ * lines the client picks out: ABSO_SHOT_IMAGE {json}, blocks between
43+ * ABSO_SHOT_BEGIN <name> and ABSO_SHOT_END, and "eval: ", "page error: ",
4344 * "console " lines. No backticks or dollar-braces in here: it's a raw string.
4445 */
4546const SHOOTER = String.raw`import { chromium } from 'playwright';
4647import { writeFileSync } from 'node:fs';
47−const c = JSON.parse(process.env.AVCS_SHOT);
48+const c = JSON.parse(process.env.ABSO_SHOT);
4849const b = await chromium.launch();
4950const p = await b.newPage({ viewport: { width: c.w, height: c.h } });
5051const logged = [];
Lines 98–106 at 318 (were 97–105 at 7)
9798 return out;
9899};
99100const block = (name, text, max) => {
100− console.log('AVCS_SHOT_BEGIN ' + name);
101+ console.log('ABSO_SHOT_BEGIN ' + name);
101102 console.log(text.length > max ? text.slice(0, max) + '\n... (' + (text.length - max) + ' more characters; --max-chars raises the cap)' : text);
102− console.log('AVCS_SHOT_END');
103+ console.log('ABSO_SHOT_END');
103104};
104105const at = async (spec) => {
105106 if (spec.ref === undefined) return [spec.x, spec.y];
Lines 149–155 at 318 (were 148–154 at 7)
148149 h = sh;
149150 }
150151 writeFileSync(c.out, png);
151− console.log('AVCS_SHOT_IMAGE ' + JSON.stringify({ w, h, bytes: png.length }));
152+ console.log('ABSO_SHOT_IMAGE ' + JSON.stringify({ w, h, bytes: png.length }));
152153}
153154for (const l of logged) console.log('console ' + l);
154155if (dropped > 0) console.log('console (' + dropped + ' more messages not shown)');
Lines 197–211 at 318 (were 196–210 at 7)
196197 const size = str(args, "size") ?? "1280x720";
197198 if (!/^\d{2,5}x\d{2,5}$/.test(size)) throw new UsageError("--size is WIDTHxHEIGHT, like 1280x720");
198199 const [width, height] = size.split("x").map(Number) as [number, number];
199− // --eval and --click set the page up before the shot (#37, Builder 7): JS first, then each click, in order.
200+ // --eval and --click set the page up before the shot (#37): JS first, then each click, in order.
200201 const evalJs = str(args, "eval");
201− // x,y@ms waits ms before that click (#37, Writer 1): a card --eval or an earlier click brings up may need a draw or two.
202+ // x,y@ms waits ms before that click (#37): a card --eval or an earlier click brings up may need a draw or two.
202203 const clicks = (str(args, "click") ?? "")
203204 .split(";")
204205 .map((s) => s.trim())
205206 .filter((s) => s !== "")
206207 .map((s) => shotPoint(s, "--click", true));
207− // --mouse leaves the pointer over a point for the shot, for hover cards (#37, Builder 7).
208+ // --mouse leaves the pointer over a point for the shot, for hover cards (#37).
208209 const mouseSpec = str(args, "mouse");
209210 const mouse = mouseSpec === undefined ? null : shotPoint(mouseSpec, "--mouse", false);
210211 for (const pt of [...clicks, ...(mouse ? [mouse] : [])]) {
Lines 261–267 at 318 (were 260–266 at 7)
260261 eval: evalJs ?? null,
261262 clicks,
262263 mouse,
263− out: `.avcs-shot/${name}`,
264+ out: `.abso-shot/${name}`,
264265 image,
265266 scale,
266267 region,
Lines 282–297 at 318 (were 281–296 at 7)
281282 "(npx --no-install vite --host 127.0.0.1 --port 4173 --strictPort >/tmp/shot-vite.log 2>&1 &)",
282283 "for i in $(seq 120); do curl -sf -o /dev/null http://127.0.0.1:4173/ && break; sleep 0.5; done",
283284 'curl -sf -o /dev/null http://127.0.0.1:4173/ || { echo "the vite dev server did not start:"; tail -20 /tmp/shot-vite.log; exit 1; }',
284− "mkdir -p .avcs-shot",
285− `cat > .avcs-shot/shoot.mjs <<'AVCS_SHOT_EOF'\n${SHOOTER}\nAVCS_SHOT_EOF`,
286− `AVCS_SHOT=${shellWord(JSON.stringify(setup))} node .avcs-shot/shoot.mjs`,
285+ "mkdir -p .abso-shot",
286+ `cat > .abso-shot/shoot.mjs <<'ABSO_SHOT_EOF'\n${SHOOTER}\nABSO_SHOT_EOF`,
287+ `ABSO_SHOT=${shellWord(JSON.stringify(setup))} node .abso-shot/shoot.mjs`,
287288 ].join("\n");
288289 const said: string[] = [];
289290 const keep = (t: string) => void said.push(t);
290291 const flags = new Map<string, string | boolean>();
291292 const box = str(args, "box");
292293 if (box !== undefined) flags.set("box", box);
293− // --at shoots a version of the folder's space instead of the folder, as abso run --at runs one (#37, Builder 5).
294+ // --at shoots a version of the folder's space instead of the folder, as abso run --at runs one (#37).
294295 const at = str(args, "at");
295296 if (at !== undefined && !/^\d+$/.test(at))
296297 throw new UsageError(`--at is a version number (got ${JSON.stringify(at)})`);
Lines 309–318 at 318 (were 308–317 at 7)
308309 }
309310 const blocks: { name: string; text: string }[] = [];
310311 for (let i = 0; i < lines.length; i++) {
311− if (!lines[i]!.startsWith("AVCS_SHOT_BEGIN ")) continue;
312− const end = lines.indexOf("AVCS_SHOT_END", i + 1);
312+ if (!lines[i]!.startsWith("ABSO_SHOT_BEGIN ")) continue;
313+ const end = lines.indexOf("ABSO_SHOT_END", i + 1);
313314 blocks.push({
314− name: lines[i]!.slice("AVCS_SHOT_BEGIN ".length),
315+ name: lines[i]!.slice("ABSO_SHOT_BEGIN ".length),
315316 text: lines.slice(i + 1, end < 0 ? undefined : end).join("\n"),
316317 });
317318 if (end > i) i = end;
Lines 328–344 at 318 (were 327–342 at 7)
327328 const out: string[] = [];
328329 let shot: { path: string; w: number; h: number; bytes: number; tokens: number } | null = null;
329330 if (image) {
330− const info = lines.find((l) => l.startsWith("AVCS_SHOT_IMAGE "));
331+ const info = lines.find((l) => l.startsWith("ABSO_SHOT_IMAGE "));
331332 const { root, api } = open(env);
332− void root;
333333 api.box = boxOf(args, env);
334− const gz = await api.boxFiles(`.avcs-shot/${name}`);
335− const png = gz === null ? undefined : untarGz(gz).find((e) => e.path === `.avcs-shot/${name}`);
334+ const gz = await api.boxFiles(`.abso-shot/${name}`);
335+ const png = gz === null ? undefined : untarGz(gz).find((e) => e.path === `.abso-shot/${name}`);
336336 if (!png || !info)
337337 return { exit: EXIT.error, text: "The screenshot ran but its file was not in the box.", json: { notes } };
338− const { w, h } = JSON.parse(info.slice("AVCS_SHOT_IMAGE ".length)) as { w: number; h: number };
339− const path = resolve(env.cwd, str(args, "out") ?? join(".avcs", "shots", name));
338+ const { w, h } = JSON.parse(info.slice("ABSO_SHOT_IMAGE ".length)) as { w: number; h: number };
339+ // In the folder's own state folder (.abso/, or .avcs/ in an older folder), which abso never records.
340+ const path =
341+ str(args, "out") !== undefined ? resolve(env.cwd, str(args, "out")!) : join(stateDir(root), "shots", name);
340342 mkdirSync(join(path, ".."), { recursive: true });
341343 writeFileSync(path, png.data);
342344 shot = { path, w, h, bytes: png.data.length, tokens: imageTokens(w, h) };
MCP
compare on this site's /mcp
CLI
abso diff 7 318 client/src/serve-commands.ts --json
JSON
/christopher/abso-core/compare/7..318?file=client%2Fsrc%2Fserve-commands.ts&format=json