10 files, 174 lines added, 56 removed.
--- a/client/src/body-files.ts
+++ b/client/src/body-files.ts
@@ -2,7 +2,7 @@
22// passes a native command's argument badly, so a multi-line --comment, 33// --description or answer reached the server cut to its first line, and nobody 44// knew. Any text flag also takes --<flag>-file <path>, and the commands whose 5−// text is their words (ask, answer, announce) take --file <path>. A path of -
5+// text is their words (ask, answer, reply, announce) take --file <path>. A path of - 66// reads stdin. The file's text arrives whole on any shell. 88import { readFileSync } from "node:fs"; @@ -12,7 +12,7 @@
1212/** The text flags a command may take from a file instead. */ 1313const BODY_FLAGS = ["message", "comment", "object", "description", "note"] as const; 1414/** Commands whose text is their last words: --file gives those words. */ 15−const WORDS_FROM_FILE = new Set(["ask", "answer", "announce"]);
15+const WORDS_FROM_FILE = new Set(["ask", "answer", "reply", "announce"]); 1717/** The command's flags, plus a -file twin for each text flag it takes, and --file where its words are its text. */ 1818export function withBodyFiles(command: string, spec: FlagSpec): FlagSpec { @@ -75,7 +75,7 @@
7676 const path = flags.get("file"); 7777 if (WORDS_FROM_FILE.has(command) && typeof path === "string") { 78− // ask <who> and answer <ask> keep their first word; announce's words are all text.
78+ // ask <who>, answer <ask> and reply <ask> keep their first word; announce's words are all text. 7979 const keep = command === "announce" ? 0 : 1; 8080 if (positionals.length > keep) 8181 throw new UsageError(`--file gives ${command}'s text, so leave the words off the command line`); --- a/client/src/doctor.ts
+++ b/client/src/doctor.ts
@@ -327,13 +327,13 @@
329329 * The commonest failures in plain words, with the next step: no credential, a credential the server refuses, and a 330− * server that can't be reached. Anything else is left as it was. `signedIn` is whether the call carried a key or token.
330+ * server that can't be reached. Anything else is left as it was. `sent` names the key or token the call carried, if any. 332−export function plainError(err: unknown, signedIn: boolean, tokenFileUnasked = false): string | undefined {
332+export function plainError(err: unknown, sent: string | undefined, tokenFileUnasked = false): string | undefined { 333333 if (!(err instanceof ApiError)) return undefined; 334334 if (err.status === 401) 335− return signedIn
336− ? `The server didn't accept this folder's key: it may be revoked or expired. abso doctor checks it. (${err.message})`
335+ return sent !== undefined 336+ ? `The server didn't accept ${sent}: it may be revoked or expired. abso doctor checks it. (${err.message})` 337337 : `You're not signed in. Run abso login, then abso join <project>.${tokenFileUnasked ? " ~/.abso/token is used only with --token-file." : ""}`; 338338 if (err.status === undefined && err.message.startsWith("could not reach ")) { 339339 const said = err.message.replace(/^could not reach /, "Can't reach "); --- a/client/src/install.ts
+++ b/client/src/install.ts
@@ -517,7 +517,18 @@
517517 readonly current: string; 520−/** `avcs --version`: this client, and the mods installed on this machine, compared with this client's. */
521+ * The command that runs one of this client's installers (client/install-mod.ts or install-view.ts), by its full 522+ * path. They are .ts files, which Node runs itself from 22.18, so on an older Node it says which one it needs. 524+export function installerCommand(installer: string): string { 525+ const command = `node ${join(CLIENT_DIR, installer)}`; 526+ return (process.features as { typescript?: unknown }).typescript 528+ : `${command} (with Node 22.18 or later, which runs .ts files; this is Node ${process.versions.node})`; 531+/** `abso --version`: this client, and the mods installed on this machine, compared with this client's. */ 521532export function versionReport(env: Readonly<Record<string, string | undefined>>): { 523534 json: Record<string, unknown>; @@ -554,14 +565,14 @@
555566 // A built copy has no mod files to compare with or install from: it reports what is installed. 556567 if (m.version === undefined) { 557− lines.push(`the ${m.name} mod: not installed${builtCopy() ? "" : ` (node client/${installer})`}`);
568+ lines.push(`the ${m.name} mod: not installed${builtCopy() ? "" : ` (${installerCommand(installer)})`}`); 560571 const when = m.at ? `, installed ${m.at.slice(0, 16).replace("T", " ")} UTC` : ""; 562573 builtCopy() || m.version === m.current 564− : `; this client has ${m.current}: node client/${installer} installs it`;
575+ : `; this client has ${m.current}: ${installerCommand(installer)} installs it`; 565576 lines.push(`the ${m.name} mod: ${m.version} in ${m.folder}${when}${behind}`); 567578 return { text: lines.join("\n"), json: { client, folder: CLIENT_DIR, mods } }; @@ -579,6 +590,6 @@
579590 .filter((m) => m.version?.includes("+") && /\+[0-9a-f]{7}$/.test(m.current) && m.version !== m.current) 582− `The ${m.name} mod installed on this machine is ${m.version}, and this client has ${m.current}: node client/${installers[m.name]} installs it (new chats load it).`,
593+ `The ${m.name} mod installed on this machine is ${m.version}, and this client has ${m.current}: ${installerCommand(installers[m.name]!)} installs it (new chats load it).`, --- a/client/src/join-commands.ts
+++ b/client/src/join-commands.ts
@@ -3,7 +3,7 @@
33import { randomUUID } from "node:crypto"; 44import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs"; 55import { join, relative, resolve } from "node:path"; 6−import { Api, ApiError } from "./api.ts";
6+import { Api, ApiError, type SyncAnswer } from "./api.ts"; 77import { bool, type Parsed, str, UsageError } from "./args.ts"; 88import { writeKnownBlobs } from "./blobs.ts"; @@ -16,9 +16,9 @@
1818import { STARTING_ABSOIGNORE } from "./check-ignore.ts"; 19−import { CLIENT_DIR } from "./client-version.ts";
19+import { builtCopy } from "./client-version.ts"; 2020import { type Env, type Output, plural } from "./command-env.ts"; 21−import { leftOutText, syncFolder, uploadBlobs } from "./commands.ts";
21+import { applyAnswer, leftOutText, pullAnswer, pullWritten, syncFolder, uploadBlobs } from "./commands.ts"; @@ -32,7 +32,7 @@
3232import { elsewhereText } from "./doctor.ts"; 3333import { fromEnv } from "./env-names.ts"; 3434import { clearKnown, loadIgnore, readFolder, writeKnown } from "./folder.ts"; 35−import { modInstalled } from "./install.ts";
35+import { installerCommand, modInstalled } from "./install.ts"; 3636import { type FullMode, foldModes, writeKnownModes } from "./modes.ts"; 3737import { initInOrg, siteOf } from "./orgs.ts"; 3838import { projectFileName, readProjectFile, startingProjectFileText, writeStartingProjectFile } from "./project-file.ts"; @@ -141,12 +141,20 @@
141141 say(`Signing in with ${credential?.words ?? `no credential: nothing here signs in to ${server}`}. 143143 const api = new Api({ ...config, ...(token ? { token } : {}) }); 144− await uploadBlobs(api, blobs);
145− const answer = await api.init(
146− Object.fromEntries(files),
147− modes,
148− Object.fromEntries([...blobs].map(([rel, b]) => [rel, b.sha])),
149− );
144+ let answer: Awaited<ReturnType<Api["init"]>>; 146+ await uploadBlobs(api, blobs); 147+ answer = await api.init( 148+ Object.fromEntries(files), 150+ Object.fromEntries([...blobs].map(([rel, b]) => [rel, b.sha])), 153+ // No project was made: the starting files init wrote go too, so the folder is as it was. 154+ if (wroteIgnore) rmSync(absoignore, { force: true }); 155+ if (typeof wroteProject !== "string") rmSync(join(root, projectFileName(root)), { force: true }); 150158 writeConfig(root, config); 152160 for (const [rel, text] of files) writeKnown(root, rel, text); @@ -351,6 +359,16 @@
362+/** A join that failed before writing files: its state goes, but a key (already here, or made for it) stays for the next try. */ 363+function takeBackJoin(root: string): void { 364+ const dir = stateDir(root); 365+ if (!existsSync(join(dir, "key"))) { 366+ rmSync(dir, { recursive: true, force: true }); 369+ for (const entry of readdirSync(dir)) if (entry !== "key") rmSync(join(dir, entry), { recursive: true, force: true }); 354372export async function runJoin(args: Parsed, env: Env): Promise<Output> { 355373 if (args.positionals.length !== 1) throw new UsageError("join takes the project name: abso join <project>"); 356374 const project = args.positionals[0]!; @@ -399,25 +417,34 @@
400418 if (minted) installKey(root, JSON.stringify(minted)); 401419 // The token file only with --token-file: readConfig reads it otherwise. 402− const read = readConfig(root, env.env, false);
420+ let read: ReturnType<typeof readConfig>; 422+ read = readConfig(root, env.env, false); 403427 const settings = tokenFileAsked ? { ...read, token: credential?.token } : read; 404428 (env.writeErr ?? env.write)( 405429 `Signing in with ${minted && box ? `a new key from this box's sign-in, ${box.id}` : hasKey ? "this folder's key" : (credential?.words ?? `no credential: nothing here signs in to ${server}`)}. 408432 const api = new Api(settings); 409− let synced: Awaited<ReturnType<typeof syncFolder>>;
433+ let answer: SyncAnswer; 411435 // Before the sync, so the server never takes a record from this folder. 412436 if (reader) await api.reader(true); 413437 // Every file, even when the server has seen this agent sync before: its plain sync answer would hold only what changed since (#37). 414− synced = await syncFolder(root, api, true);
438+ answer = await pullAnswer(root, api, true); 440+ // Nothing is written yet: take back what join wrote so it can run again here. 416442 if (!(error instanceof ApiError && error.status === 401 && !box && !settings.token)) throw error; 417− rmSync(stateDir(root), { recursive: true, force: true });
418443 const why = await signedOut(config.server, project); 419444 throw new UsageError(!tokenFileAsked && tokenFile() !== undefined ? `${why} ${TOKEN_FILE_ASKED}` : why); 446+ const synced = await applyAnswer(root, api, answer); 423450 `Joined ${project} as ${config.agent} at version ${synced.version}: wrote ${plural(synced.written.length, "file")} into ${root}.${reader ? " It is a reader: status, pull, log, show, files and export work, and nothing it does is recorded or pushed." : ""}${minted ? ` It signs in with its own key, ${minted.id}, made from this box's sign-in.` : ""}`, @@ -454,7 +481,9 @@
456483function hookHint(env: Readonly<Record<string, string | undefined>>): string { 457− return modInstalled(env)
458− ? "Edits made by Claude Code here are recorded by the abso mod on this machine, signed in as this folder. Anything else: abso record."
459− : `Edits made by Claude Code reach the server through the abso mod, which isn't on this machine yet: node ${join(CLIENT_DIR, "install-mod.ts")} installs it, and new chats load it. Anything else: abso record.`;
484+ if (modInstalled(env)) 485+ return "Edits made by Claude Code here are recorded by the abso mod on this machine, signed in as this folder. Anything else: abso record."; 486+ // A built copy (the npm package) has no installer to point at (abso-core 18). 487+ if (builtCopy()) return "abso record sends the edits made here, whoever made them."; 488+ return `Edits made by Claude Code reach the server through the abso mod, which isn't on this machine yet: ${installerCommand("install-mod.ts")} installs it, and new chats load it. Anything else: abso record.`; --- a/client/src/main.ts
+++ b/client/src/main.ts
@@ -1,8 +1,8 @@
11// The command table and the dispatcher. main() returns what to print and the 22// exit code instead of printing, so tests can call it directly. 4−import { readFileSync } from "node:fs";
5−import { resolve } from "node:path";
4+import { existsSync, readFileSync } from "node:fs"; 5+import { join, resolve } from "node:path"; 66import { runAnnounce, runNews, runStart } from "./announce.ts"; 77import { ApiError } from "./api.ts"; 88import { bool, type FlagSpec, type Parsed, parseArgs, str, UsageError } from "./args.ts"; @@ -38,7 +38,7 @@
4040} from "./commands.ts"; 41−import { configPath, findRoot, installKey, isVisitor, readConfig, tokenFile } from "./config.ts";
41+import { configPath, findRoot, installKey, isVisitor, readConfig, runKey, tokenFile } from "./config.ts"; 4242import { newsBlockLines, newsShown } from "./core.ts"; 4343import { doctor, doctorText, plainError, realProbe, whoami } from "./doctor.ts"; 4444import { runDraftSync, runLand, runSwitch } from "./drafts.ts"; @@ -73,6 +73,7 @@
7474} from "./server-choice.ts"; 7575import { installSkill, SKILL, skillPath } from "./skill.ts"; 76+import { stateDir } from "./state-dir.ts"; 7677import { colorsPass, terminalText } from "./terminal-text.ts"; 7778import { runAmend, runDrop, runFollow, runLabel, runLabels, runPluck } from "./versions.ts"; 7879import { runVisibility } from "./visibility-commands.ts"; @@ -124,7 +125,7 @@
125126 "abso init [folder] --project <name> [--agent <name>] [--as-is] [--org <org>] [--public|--private] [--token-file]", 127− "Create a project on the server from a folder's text files The folder becomes that agent's folder. It writes a starting .absoignore, and, when the folder has no avcs.json and package.json gives a check or a build to guess, an avcs.json (setup, check, build and out): what the server's CI runs on each new version of shared. Without one, CI runs what it can guess itself, or nothing. --as-is writes neither: the folder goes up exactly as it is (an import). On a server this box is signed in to (abso login, approving all your projects), the project is made as you, the way the website's New project makes it: you own it, it's private unless you say --public, and the folder joins it at once with its own key (--agent names it; else the box's name). --org <org> makes it that organization's project. Elsewhere it needs --agent and a token: ABSO_TOKEN, or with --token-file this machine's ~/.abso/token, which is never used unasked. Before it makes anything, it says what it signs in with.",
128+ "Create a project on the server from a folder's text files. The folder becomes that agent's folder. It writes a starting .absoignore, and, when the folder has no abso.json and package.json gives a check or a build to guess, an abso.json (setup, check, build and out): what the server's CI runs on each new version of shared. Without one, CI runs what it can guess itself, or nothing. --as-is writes neither: the folder goes up exactly as it is (an import). On a server this box is signed in to (abso login, approving all your projects), the project is made as you, the way the website's New project makes it: you own it, it's private unless you say --public, and the folder joins it at once with its own key (--agent names it; else the box's name). --org <org> makes it that organization's project. Elsewhere it needs --agent and a token: ABSO_TOKEN, or with --token-file this machine's ~/.abso/token, which is never used unasked. Before it makes anything, it says what it signs in with.", 128129 run: (args, env) => runInit(args, env), @@ -140,7 +141,7 @@
141142 "abso key install [--server <url> [--dir <folder>]] | abso key new <agent> [--server <url> [--dir <folder>]] [--project <name>] [--expires <Nd>] [--role owner|writer|reader] [--print] | abso key list [--agent <name>] [--project <name>] | abso key revoke <id> [--project <name>]", 143− "install reads {key, id} from stdin into .abso/key. With --server, it writes it into a folder not joined yet, so abso join there signs in with the key. new writes the key into that folder and prints only the id; its role is writer unless --role says otherwise (a reader only reads; a writer writes on its own agent's routes; an owner also skips or revokes CI, resumes the queue, syncs git and exports); --print writes the key to stdout instead. list and revoke never print a key. These three read the admin token from AVCS_ADMIN_TOKEN or ~/.abso/admin-token and send it only to a server named in AVCS_ADMIN_SERVERS. An agent does not run them unless a person on the project says so.",
144+ "install reads {key, id} from stdin into .abso/key. With --server, it writes it into a folder not joined yet, so abso join there signs in with the key. new writes the key into that folder and prints only the id; its role is writer unless --role says otherwise (a reader only reads; a writer writes on its own agent's routes; an owner also skips or revokes CI, resumes the queue, syncs git and exports); --print writes the key to stdout instead. list and revoke never print a key. These three read the admin token from ABSO_ADMIN_TOKEN or ~/.abso/admin-token and send it only to a server named in ABSO_ADMIN_SERVERS. An agent does not run them unless a person on the project says so.", 144145 run: async (args, env) => { 145146 const sub = args.positionals[0]; 146147 if (sub === "install" && args.positionals.length === 1) return runKeyInstall(args, env); @@ -352,7 +353,7 @@
353354 usage: 'abso push -m "<why>" [--as-is] [--check ["<command>"]] [--wait <seconds> | --no-wait] [--done]', 355− 'Record, then add your draft to shared. Refused when it collides with work pushed since your last pull, or when lines a pull showed changed on both sides are still untouched (--as-is pushes both sides\' lines anyway). --check "<command>" (e.g. --check "npm run typecheck") first pulls, then runs the command in your box on your draft with newest shared, and pushes only if it exits 0, so two changes that each pass alone can\'t turn shared red. --check alone runs the "build" and then the "check" in the project\'s avcs.json (your draft\'s copy), as the server does on each new version. With the merge queue on ("queue": true in avcs.json), a push to shared is queued and lands only once the project\'s check passes on shared with it on top: push waits up to 100 s for that (--wait <seconds> changes it, --no-wait returns at once), then says it landed (exit 0), was turned back with the check\'s output (exit 2, its changes still in your draft), or is still queued (exit 3; the outcome comes as news). --check alone is skipped then, since the queue runs the check. --done takes your start note back once it\'s pushed: this push finishes that work.',
356+ 'Record, then add your draft to shared. Refused when it collides with work pushed since your last pull, or when lines a pull showed changed on both sides are still untouched (--as-is pushes both sides\' lines anyway). --check "<command>" (e.g. --check "npm run typecheck") first pulls, then runs the command in your box on your draft with newest shared, and pushes only if it exits 0, so two changes that each pass alone can\'t turn shared red. --check alone runs the "build" and then the "check" in the project\'s abso.json (your draft\'s copy), as the server does on each new version. With the merge queue on ("queue": true in abso.json), a push to shared is queued and lands only once the project\'s check passes on shared with it on top: push waits up to 100 s for that (--wait <seconds> changes it, --no-wait returns at once), then says it landed (exit 0), was turned back with the check\'s output (exit 2, its changes still in your draft), or is still queued (exit 3; the outcome comes as news). --check alone is skipped then, since the queue runs the check. --done takes your start note back once it\'s pushed: this push finishes that work.', @@ -400,7 +401,7 @@
401402 'abso run [--detach] [--replace] [--fresh] [--box <name>] [--at <version> [--files <glob>]] <command...> | abso run ... -- <program> <arg...> | abso run --parallel "<command>" "<command>"...', 403− "Send the folder to this agent's box, run the command there, and stream its output back. Exits with the command's code. After --, each word goes to the program exactly as typed (quotes, backslashes, regex text); without --, the words are one shell command. The box's stderr comes out on stderr. --detach starts it and prints its id without waiting. While a run is still going in the box, a new one is refused (409, naming it), since it would replace the files under it; --replace stops the old one first. --parallel runs each quoted command at once in the box (one upload), labels each line [1], [2], ..., ends with each one's exit code, and exits with the worst. --at <version> runs that version of the folder's space instead of the folder (for bisecting); with --files <glob>, only the matching files are taken from that version. The folder is never touched. --fetch <glob>[,<glob>...] brings matching files from the box's /w back after the run (see abso fetch); several globs go in one argument, comma-separated (--fetch 'shots/*.png,out/*.json'), as for --files and --with. The box's /w is replaced by your folder on every run; the rest of the box (/tmp, ~/.cache, /w/node_modules) lasts between runs until the box stops (idle 30 minutes, or restarted). abso's own notices go to stderr, apart from the command's output; --quiet drops them (the command's own stderr still comes through). --with <box path>=<local path>[,...] adds files (or a folder's files) for this run only: they go to the box and are never written to your folder or recorded, for an A/B run that leaves the project alone. --box <name> (or AVCS_BOX=<name>) runs in another box of yours, with its own /w and state, so a subagent's runs and yours don't wait on each other; logs and fetch take --box too. After abso prep, a fresh box starts from the prep; --fresh starts this run from the plain image instead.",
404+ "Send the folder to this agent's box, run the command there, and stream its output back. Exits with the command's code. After --, each word goes to the program exactly as typed (quotes, backslashes, regex text); without --, the words are one shell command. The box's stderr comes out on stderr. --detach starts it and prints its id without waiting. While a run is still going in the box, a new one is refused (409, naming it), since it would replace the files under it; --replace stops the old one first. --parallel runs each quoted command at once in the box (one upload), labels each line [1], [2], ..., ends with each one's exit code, and exits with the worst. --at <version> runs that version of the folder's space instead of the folder (for bisecting); with --files <glob>, only the matching files are taken from that version. The folder is never touched. --fetch <glob>[,<glob>...] brings matching files from the box's /w back after the run (see abso fetch); several globs go in one argument, comma-separated (--fetch 'shots/*.png,out/*.json'), as for --files and --with. The box's /w is replaced by your folder on every run; the rest of the box (/tmp, ~/.cache, /w/node_modules) lasts between runs until the box stops (idle 30 minutes, or restarted). abso's own notices go to stderr, apart from the command's output; --quiet drops them (the command's own stderr still comes through). --with <box path>=<local path>[,...] adds files (or a folder's files) for this run only: they go to the box and are never written to your folder or recorded, for an A/B run that leaves the project alone. --box <name> (or ABSO_BOX=<name>) runs in another box of yours, with its own /w and state, so a subagent's runs and yours don't wait on each other; logs and fetch take --box too. After abso prep, a fresh box starts from the prep; --fresh starts this run from the plain image instead.", @@ -615,7 +616,7 @@
615616 flags: { version: "string", revoke: "boolean" }, 616617 usage: "abso ci [<version>] | abso ci --revoke", 618− "The project's CI: the server runs avcs.json's setup, build and check on each new version of shared, one job at a time on the newest. abso ci says whether shared is green or red (and since which version, by whom, once a bisect finds it), what is being checked, and the preview link of the newest passing build, which needs no token. abso ci <version> shows that version's job: which step failed, its exit code, and the end of its output. status says the same in a line, and log marks each version of shared. --revoke ends every preview link handed out so far and makes a new one.",
619+ "The project's CI: the server runs abso.json's setup, build and check on each new version of shared, one job at a time on the newest. abso ci says whether shared is green or red (and since which version, by whom, once a bisect finds it), what is being checked, and the preview link of the newest passing build, which needs no token. abso ci <version> shows that version's job: which step failed, its exit code, and the end of its output. status says the same in a line, and log marks each version of shared. --revoke ends every preview link handed out so far and makes a new one.", @@ -641,7 +642,7 @@
642643 'abso shot ["/<path>?<query>"] [--scale 0.1-1] [--region x0,y0,x1,y1] [--text] [--tree [--interactive] [--depth N]] [--find "<text>"] [--max-chars N] [--image] [--at <version>] [--eval "<js>"] [--click "x,y[@ms];ref_N[@ms]"] [--mouse x,y|ref_N] [--out <file.png>] [--wait <ms>] [--size <w>x<h>]', 644− "A look at your folder's game, taken in your box: it runs the project's vite dev server and Playwright on that page (default /, a 1280x720 page). Images cost tokens, so read without one when you can: --text prints the page's visible text, --tree its elements (role, name, a ref like ref_12, and its box in page pixels; --interactive only what can be clicked or typed in; --depth N levels), and --find \"<text>\" the elements matching some text; each is capped at --max-chars (default 5000). With none of those, or with --image, it writes a PNG to .avcs/shots/ (never recorded) or --out, and prints its pixel size and about how many tokens reading it costs (width x height / 750). --scale 0.5 halves the width and height (a quarter of the tokens); --region x0,y0,x1,y1 takes part of the page at full detail; they combine. Coordinates are always the page's, whatever the scale or region. To set up a state first, --eval runs JavaScript in the page and --click clicks points (x,y or ref_N; several separated by ;; @ms waits first), in that order, a second after load and two frames after the eval; --mouse x,y or ref_N leaves the pointer there (for hover cards); then it waits --wait ms (default 3000) and looks. It prints --eval's result, page errors and the first 30 console messages. Refs come from --tree or --find on the same page in the same state. --at <version> looks at that version of your folder's space instead of the folder (as abso run --at). Needs vite and playwright in the project's devDependencies; abso prep with npx --no-install playwright install chromium makes it fast.",
645+ "A look at your folder's game, taken in your box: it runs the project's vite dev server and Playwright on that page (default /, a 1280x720 page). Images cost tokens, so read without one when you can: --text prints the page's visible text, --tree its elements (role, name, a ref like ref_12, and its box in page pixels; --interactive only what can be clicked or typed in; --depth N levels), and --find \"<text>\" the elements matching some text; each is capped at --max-chars (default 5000). With none of those, or with --image, it writes a PNG to .abso/shots/ (never recorded) or --out, and prints its pixel size and about how many tokens reading it costs (width x height / 750). --scale 0.5 halves the width and height (a quarter of the tokens); --region x0,y0,x1,y1 takes part of the page at full detail; they combine. Coordinates are always the page's, whatever the scale or region. To set up a state first, --eval runs JavaScript in the page and --click clicks points (x,y or ref_N; several separated by ;; @ms waits first), in that order, a second after load and two frames after the eval; --mouse x,y or ref_N leaves the pointer there (for hover cards); then it waits --wait ms (default 3000) and looks. It prints --eval's result, page errors and the first 30 console messages. Refs come from --tree or --find on the same page in the same state. --at <version> looks at that version of your folder's space instead of the folder (as abso run --at). Needs vite and playwright in the project's devDependencies; abso prep with npx --no-install playwright install chromium makes it fast.", @@ -857,7 +858,7 @@
858859 "abso pipeline check [file] [--on push|draft|green|land|hand|schedule [--space <name>] [--pipeline <name>] [--every <when>]] | abso pipeline runs [<run>] [--log <pipeline.job>]", 860− "Read the folder's pipeline file (abso.yml, abso.yaml or avcs.json, or the file named) and say what's wrong with it, place by place: a cycle in needs, a job that doesn't exist, secrets a draft could reach, a key it doesn't know. Exits 1 when it has problems. With --on, it says which pipelines that event starts (in shared, or --space), with their jobs in waves that can run side by side, and why each other pipeline doesn't start. It reads only the file. abso pipeline runs asks the server what the project's pipelines did: the runs, newest first; with a run's number, its jobs (state, why, exit, time, an npm or deploy job's phase); with --log <pipeline.job>, that job's output.",
861+ "Read the folder's pipeline file (abso.yml, abso.yaml or abso.json, or the file named) and say what's wrong with it, place by place: a cycle in needs, a job that doesn't exist, secrets a draft could reach, a key it doesn't know. Exits 1 when it has problems. With --on, it says which pipelines that event starts (in shared, or --space), with their jobs in waves that can run side by side, and why each other pipeline doesn't start. It reads only the file. abso pipeline runs asks the server what the project's pipelines did: the runs, newest first; with a run's number, its jobs (state, why, exit, time, an npm or deploy job's phase); with --log <pipeline.job>, that job's output.", 861862 // Loaded only here, so the yaml package it needs can't stop every other command 862863 // when a checkout lacks it (abso issue 168). 863864 run: async (args, env) => { @@ -962,14 +963,16 @@
964965/** Whether this folder's calls carry a key or token, for how a refusal is worded. False when that can't be told. */ 965−function carriesCredential(env: Env, tokenFileAsked: boolean): boolean {
966+function credentialSent(env: Env, tokenFileAsked: boolean): string | undefined { 967968 const root = findRoot(env.cwd); 968− return root
969− ? readConfig(root, env.env, tokenFileAsked).token !== undefined
970− : (fromEnv(env.env, "TOKEN") ?? (tokenFileAsked ? tokenFile() : undefined)) !== undefined;
969+ if (root && readConfig(root, env.env, tokenFileAsked).token === undefined) return undefined; 970+ if (root && existsSync(join(stateDir(root), "key"))) return "this folder's key"; 971+ if (fromEnv(env.env, "TOKEN")?.trim()) return "ABSO_TOKEN"; 972+ if (root && runKey(env.env)) return "this pipeline run's key"; 973+ return tokenFileAsked && tokenFile() !== undefined ? "the token file, ~/.abso/token" : undefined; 972− return false;
@@ -1079,7 +1082,7 @@
10791082 const e = err as Error; 10801083 const code = err instanceof UsageError ? "usage" : err instanceof ApiError ? "server" : "error"; 1082− plainError(err, carriesCredential(env, asked), !asked && tokenFile() !== undefined) ??
1085+ plainError(err, credentialSent(env, asked), !asked && tokenFile() !== undefined) ?? 10831086 (err instanceof UsageError || err instanceof ApiError 10851088 : `${e.message}${e.stack ? `\n${e.stack}` : ""}`); --- a/client/src/serve-commands.ts
+++ b/client/src/serve-commands.ts
@@ -6,6 +6,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"; 1112/** abso serve [--version N]: a preview of one version of shared at a stable URL, built once on the server (#37). */ @@ -329,14 +330,15 @@
330331 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); 334334 const gz = await api.boxFiles(`.abso-shot/${name}`); 335335 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 } }; 338338 const { w, h } = JSON.parse(info.slice("ABSO_SHOT_IMAGE ".length)) as { w: number; h: number }; 339− const path = resolve(env.cwd, str(args, "out") ?? join(".avcs", "shots", name));
339+ // In the folder's own state folder (.abso/, or .avcs/ in an older folder), which abso never records. 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) }; --- a/client/test/body-files.test.ts
+++ b/client/test/body-files.test.ts
@@ -15,6 +15,9 @@
1515// Written with one Windows line ending inside, which arrives as LF. 1616writeFileSync(join(dir, "body.md"), `${BODY.replace("- two\n", "- two\r\n")}\r\n`); 1717writeFileSync(join(dir, "empty.md"), "\n \n"); 18+// A reply as agents write them: prose, a code block and a Windows path, which no shell quoting mangles here. 19+const REPLY = 'Checked it:\n\n```ts\nconst x = "a\\tb";\n```\n\nThe log is in C:\\Users\\me\\repo\\out.txt.'; 20+writeFileSync(join(dir, "reply.md"), `${REPLY}\n`); 1922const ISSUE = { comment: "string", description: "string", title: "string", drop: "boolean" } as const; 2023const parse = (command: string, spec: Record<string, "string" | "boolean">, words: string[], stdin?: string) => @@ -40,10 +43,14 @@
43− it("--file gives ask's question, answer's words and announce's text", () => {
46+ it("--file gives ask's question, answer's and reply's words, and announce's text", () => { 4447 assert.deepEqual(parse("ask", { issue: "string" }, ["alice", "--file", "body.md"]).positionals, ["alice", BODY]); 4548 assert.deepEqual(parse("answer", { note: "string" }, ["12", "--file", "body.md"]).positionals, ["12", BODY]); 4649 assert.deepEqual(parse("announce", { to: "string" }, ["--file", "body.md"]).positionals, [BODY]); 50+ const reply = parse("reply", { question: "boolean" }, ["648", "--file", "reply.md", "--question"]); 51+ assert.deepEqual(reply.positionals, ["648", REPLY]); 52+ assert.equal(reply.flags.get("question"), true); 53+ assert.match(bodyFilesHelp("reply", { question: "boolean" })!, /--file <path>/); 4855 () => parse("answer", { note: "string" }, ["12", "words", "--file", "body.md"]), 4956 /--file gives answer's text, so leave the words off the command line/, --- a/client/test/doctor.test.ts
+++ b/client/test/doctor.test.ts
@@ -211,21 +211,25 @@
212212test("plainError words a refusal by whether a credential went, and a server that can't be reached", () => { 213213 const refused = new ApiError("GET /status answered 401: missing or wrong token", 401); 214− assert.equal(plainError(refused, false), "You're not signed in. Run abso login, then abso join <project>.");
215− assert.match(plainError(refused, true)!, /^The server didn't accept this folder's key.*abso doctor checks it/);
214+ assert.equal(plainError(refused, undefined), "You're not signed in. Run abso login, then abso join <project>."); 216+ plainError(refused, "this folder's key")!, 217+ /^The server didn't accept this folder's key.*abso doctor checks it/, 219+ assert.match(plainError(refused, "ABSO_TOKEN")!, /^The server didn't accept ABSO_TOKEN: /); 217− plainError(new ApiError("could not reach https://api.abso.dev: connect ECONNREFUSED"), true),
221+ plainError(new ApiError("could not reach https://api.abso.dev: connect ECONNREFUSED"), "this folder's key"), 218222 "Can't reach https://api.abso.dev: connect ECONNREFUSED. Check your connection; abso doctor checks the rest.", 222226 new ApiError("could not reach http://x: refused. Nothing was pushed. Run the same command again."), 223− true,
227+ "this folder's key", 225229 "Can't reach http://x: refused. Nothing was pushed. Run the same command again.", 227− assert.equal(plainError(new ApiError("GET /log answered 500: boom", 500), true), undefined);
228− assert.equal(plainError(new Error("anything else"), true), undefined);
231+ assert.equal(plainError(new ApiError("GET /log answered 500: boom", 500), "this folder's key"), undefined); 232+ assert.equal(plainError(new Error("anything else"), "this folder's key"), undefined); 231235test("whoami with nothing named shows prod, and names the other servers this box is signed in to", async () => { --- /dev/null
+++ b/client/test/failed-start.test.ts
@@ -0,0 +1,60 @@
1+// An init or join that fails against the server leaves the folder as it was, so the same command can run again: 2+// no starting .absoignore or abso.json from init, no .abso/ from join (but a key already here stays). 4+import assert from "node:assert/strict"; 5+import { existsSync, mkdirSync, mkdtempSync, readdirSync, rmSync, writeFileSync } from "node:fs"; 6+import { tmpdir } from "node:os"; 7+import { join } from "node:path"; 8+import { after, describe, it } from "node:test"; 9+import { main } from "../src/main.ts"; 11+// Nothing listens on port 1, so every call fails to connect. 12+const DOWN = "http://127.0.0.1:1"; 13+const ENV = { ABSO_TOKEN: "test-token-not-secret", ABSO_SERVERS_FILE: "no-servers.json" }; 15+const dirs: string[] = []; 17+ for (const d of dirs) rmSync(d, { recursive: true, force: true, maxRetries: 5 }); 20+function temp(): string { 21+ const d = mkdtempSync(join(tmpdir(), "abso-failed-start-")); 26+async function run(cwd: string, ...argv: string[]): Promise<number> { 27+ return (await main(argv, { cwd, env: ENV, write: () => {} })).exit; 30+describe("a failed start", () => { 31+ it("init takes back the .absoignore and abso.json it wrote", async () => { 33+ writeFileSync(join(dir, "package.json"), `${JSON.stringify({ scripts: { test: "node --test" } })}\n`); 34+ assert.notEqual(await run(dir, "init", "--server", DOWN, "--project", "p", "--agent", "a"), 0); 35+ assert.deepEqual(readdirSync(dir), ["package.json"]); 38+ it("join leaves no .abso folder", async () => { 40+ assert.notEqual(await run(dir, "join", "p", "--server", DOWN, "--agent", "a", "--dir", dir), 0); 41+ assert.equal(existsSync(join(dir, ".abso")), false); 44+ it("join keeps a key that was already here", async () => { 46+ mkdirSync(join(dir, ".abso")); 47+ const key = { server: DOWN, key: "abso_sk_not-a-real-key", id: "k_0123abcd" }; 48+ writeFileSync(join(dir, ".abso", "key"), `${JSON.stringify(key)}\n`); 49+ assert.notEqual(await run(dir, "join", "p", "--server", DOWN, "--agent", "a", "--dir", dir), 0); 50+ assert.deepEqual(readdirSync(join(dir, ".abso")), ["key"]); 53+ it("join with a key it can't read leaves only that key", async () => { 55+ mkdirSync(join(dir, ".abso")); 56+ writeFileSync(join(dir, ".abso", "key"), "{}\n"); 57+ assert.notEqual(await run(dir, "join", "p", "--server", DOWN, "--agent", "a", "--dir", dir), 0); 58+ assert.deepEqual(readdirSync(join(dir, ".abso")), ["key"]); --- a/client/test/install.test.ts
+++ b/client/test/install.test.ts
@@ -26,6 +26,7 @@
2626import { clientVersion, headCommit } from "../src/client-version.ts"; @@ -427,9 +428,10 @@
427428 assert.equal(client, `abso ${clientVersion()} (${dirname(import.meta.dirname)})`); 430− /^the abso-hooks mod: 0\.1\.0\+aaaaaaa in .*skills[\\/]abso-hooks, installed 2026-10-05 04:30 UTC; this client has 0.2.0(\+[0-9a-f]{7}(\.dirty)?)?: node client\/install-mod\.ts installs it$/,
431+ /^the abso-hooks mod: 0\.1\.0\+aaaaaaa in .*skills[\\/]abso-hooks, installed 2026-10-05 04:30 UTC; this client has 0.2.0(\+[0-9a-f]{7}(\.dirty)?)?: /, 432− assert.equal(view, "the abso-view mod: not installed (node client/install-view.ts)");
433+ assert.ok(mod!.endsWith(`: ${installerCommand("install-mod.ts")} installs it`), mod); 434+ assert.equal(view, `the abso-view mod: not installed (${installerCommand("install-view.ts")})`); 433435 const json = JSON.parse( 434436 (await main(["--version", "--json"], { cwd: config, env: { CLAUDE_CONFIG_DIR: config }, write: () => {} })) @@ -474,7 +476,7 @@
474476 const current = (versionReport(env).json.mods as { current: string }[])[0]!.current; 475477 if (/\+[0-9a-f]{7}$/.test(current)) 476478 assert.deepEqual(modsBehindText(env), [ 477− `The avcs mod installed on this machine is 0.1.0+aaaaaaa, and this client has ${current}: node client/install-mod.ts installs it (new chats load it).`,
479+ `The ${AVCS_MOD.name} mod installed on this machine is 0.1.0+aaaaaaa, and this client has ${current}: ${installerCommand("install-mod.ts")} installs it (new chats load it).`, 479481 // A client outside git (an abso folder, a box) can't tell, so it says nothing. 480482 else assert.deepEqual(modsBehindText(env), []);