Versions 280 to 318
Lines 3–35 at 318 (were 3–17 at 280)
55
79
11+
13+ * Whether this command opens a local project (abso init --local): --local, or a folder whose config names the server
14+ * "local". Those load the open server's code through a module hook, and with the compile cache on Node 24 crashes.
27+
11−(nodeModule as { enableCompileCache?: () => unknown }).enableCompileCache?.();
31+if (!opensLocal()) (nodeModule as { enableCompileCache?: () => unknown }).enableCompileCache?.();
1232
13−const argv = process.argv.slice(2);
14−
Lines 3–12 at 318 (were 3–11 at 280)
33
67
78/** The world beneath the mod: a chat in /w/p, an abso folder when `inFolder`, and a server with `news` waiting. */
8−function world(on: On, inFolder: boolean, news: string[][]) {
Lines 22–28 at 318 (were 21–27 at 280)
24− return { value: JSON.stringify({ server: "https://avcs.test", project: "p", agent: "bob" }) };
Lines 115–152 at 318 (were 114–116 at 280)
114115 expect(w.written.get("/w/p/.abso/hook.log") ?? "").toContain("not sent: a NUL byte at line 3");
118+
119+test("a local project's edit goes to abso hook as Claude Code's command hook would get it, and its news to the chat", async ($, on) => {
128+ const stdout = JSON.stringify({ hookSpecificOutput: { hookEventName: "PostToolUse", additionalContext: context } });
132+ await $.tool.call({ tool: "Write", tool_use_id: "t1", file_path: "/w/p/notes.md", content: "hello\n" } as never);
Lines 33–39 at 318 (were 33–39 at 280)
36−import { STAMP } from "./stamp.ts";
3737
Lines 182–205 at 318 (were 182–196 at 280)
184184
187+/** How long abso hook may take on a local project's edit: it waits up to two minutes for the store's lock. */
189+
194+ /** What abso hook handed back for the agent, on a local project's edit (it keeps the news log itself). */
192199 } else if (/"reader"\s*:\s*true/.test((await readOr($, `${await stateOf($, job.root)}/config.json`)) ?? "")) {
201+ } else if (LOCAL_FOLDER.test((await readOr($, `${await stateOf($, job.root)}/config.json`)) ?? "")) {
Lines 220–230 at 318 (were 211–221 at 280)
212221 `${new Date(job.queuedAt).toISOString()}\t${job.tool}\t${job.rel}\t${outcome}\t${done - started}ms sending, ${started - job.queuedAt}ms queued (in process, async)\t${CLIENT}`,
214− const context = newsContext(news);
218− await log($, job.root, news.map((n) => `${at}\t${n}`).join("\n"), "news.log");
227+ if (news.length > 0) await log($, job.root, news.map((n) => `${at}\t${n}`).join("\n"), "news.log");
Lines 237–279 at 318 (were 228–233 at 280)
230239
241+ * A local project's history is in a store on this machine that only the abso command opens, so its edits go to
242+ * `abso hook` from the checkout this mod was installed from, as Claude Code's command hook would run it.
244+async function handToClient($: Engine, job: Job): Promise<{ outcome: string; context?: string }> {
248+ "skipped: a local project, and this mod has no abso to hand it to (install-mod.ts adds one); abso record sends it",
263+ if (ran.exitCode !== 0) throw new Error(`abso hook exited ${ran.exitCode}: ${ran.stderr.trim().split("\n").at(-1)}`);
269+ : (JSON.parse(out) as { hookSpecificOutput?: { additionalContext?: unknown } }).hookSpecificOutput
276+
231277/** Ask for the news waiting for this agent (announcements, collisions) and hand it to the model. */
Lines 288–294 at 318 (were 242–247 at 280)
247294 `${config.server.replace(/\/+$/, "")}/p/${encodeURIComponent(config.project)}/a/${encodeURIComponent(config.agent)}/news`,
Lines 3–11 at 318 (were 3–5 at 280)
6+
Lines 107–114 at 318 (were 107–112 at 280)
Lines 20–26 at 318 (were 20–25 at 280)
Lines 69–75 at 318 (were 68–73 at 280)
7274
Lines 193–205 at 318 (were 191–199 at 280)
192194
194− return `${server.replace(/\/+$/, "")}/p/${encodeURIComponent(this.config.project)}${path}`;
196199
202+
Lines 220–231 at 318 (were 214–219 at 280)
214220 * and follows no redirect, so nothing it sends goes anywhere it didn't name (headers() adds no sign-in).
Lines 260–267 at 318 (were 248–253 at 280)
Lines 1017–1023 at 318 (were 1003–1009 at 280)
10041018
10051019 /** A ticket that opens this agent's news stream once, within a minute (abso 690; news-stream.ts). */
1006− newsTicket(): Promise<{ url: string; protocols: string[]; expiresAt: number }> {
10091023
Lines 2–8 at 318 (were 2–8 at 280)
5−// text is their words (ask, answer, announce) take --file <path>. A path of -
77
Lines 12–18 at 318 (were 12–18 at 280)
15−const WORDS_FROM_FILE = new Set(["ask", "answer", "announce"]);
1616
1717/** The command's flags, plus a -file twin for each text flag it takes, and --file where its words are its text. */
Lines 75–81 at 318 (were 75–81 at 280)
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.
8181 throw new UsageError(`--file gives ${command}'s text, so leave the words off the command line`);
Lines 80–122 at 318 (were 80–85 at 280)
8282
90+
91+/** The stored pipeline runs, newest first, from the server's `pipelines` read; empty for anything else. */
105+
108+ const how = run.state === "planned" ? "was planned, not run," : run.state === "running" ? "is running" : run.state;
109+ return `Pipeline run ${run.id} (${run.file}) ${how} on version ${run.version}. abso pipeline runs ${run.id} shows its jobs.`;
111+
113+ * Whether the built-in check (abso.json's setup, build and check) had nothing of its own to run. With stored runs, that is
114+ * about the built-in check, not the project's CI, so it isn't said as the project's (abso 719).
119+
83120/** A shared version's mark in abso log; "not checked" says nothing, since most versions in a busy hour are covered by a newer one's job. */
Lines 180–199 at 318 (were 143–153 at 280)
145182 if (!/^\d+$/.test(typed)) throw new UsageError(`a version is a number (got ${JSON.stringify(typed)})`);
146− const job = await api.ci(Number(typed));
147− return { text: jobText(job).join("\n"), json: { ...job } };
183+ const [job, raw] = await Promise.all([api.ci(Number(typed)), api.pipelineRuns().catch(() => null)]);
185+ // A version the built-in check never ran, with a pipeline run of its own: the run is its CI (abso 719).
149− const [ci, status] = await Promise.all([api.ci(), api.status()]);
150− const lines = ciText(ci, status.version);
189+ const [ci, status, raw] = await Promise.all([api.ci(), api.status(), api.pipelineRuns().catch(() => null)]);
Lines 1–6 at 318 (were 1–5 at 280)
11// What every abso command shares: its output, its environment, the folder it opens, and the news it took.
22
Lines 49–74 at 318 (were 48–58 at 280)
51− api.caller = callerHeader({ session: env.env.CLAUDE_CODE_SESSION_ID, machine: hostname(), folder: root });
5455
57+ * The caller header for this chat, computer and folder. The chat's session id goes as a short SHA-256 of it and the
58+ * folder as its last part, so neither the raw id nor the path (which names the person) leaves the machine.
60+export function callerFor(session: string | undefined, machine: string, root: string): string | undefined {
61+ const hashed = session ? createHash("sha256").update(session).digest("hex").slice(0, 16) : undefined;
70+
Lines 11–17 at 318 (were 11–16 at 280)
1212import { type MachineServers, machineServers, TOKEN_SERVERS, tokenGoesTo, trustedList } from "./core.ts";
1516
Lines 28–41 at 318 (were 27–36 at 280)
2728 * routes anyone can read and sends no credential. It has no agent; its config holds server, project and this.
31+ /** A local project's store (abso init --local --store), when it isn't the machine's own: ABSO_STORE or the OS data folder. */
3134
37+ /** For a local project (server "local"): the store folder its history is in, or undefined when there's none to use. */
3540
Lines 69–83 at 318 (were 64–74 at 280)
6570 if (typeof raw[key] !== "string" || raw[key] === "") throw new Error(`${configPath(root)} has no "${key}"`);
67− const token = tokenFor(raw.server!, env, root, tokenFileOk);
Lines 284–300 at 318 (were 275–284 at 280)
275284
278− const { server, project, agent, follow, reader, visitor } = settings;
281− : { server, project, agent, ...(follow ? { follow } : {}), ...(reader ? { reader: true } : {}) };
Lines 327–339 at 318 (were 327–339 at 280)
327327
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 {
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})`
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." : ""}`;
new file, 13 lines
1+// What `import { DurableObject } from "cloudflare:workers"` gives the open server's code when it runs inside the client
2+// for a local project (local-store.ts): a base class that keeps the object's state and settings, which is all the
3+// project object takes from it. The build points that import here (scripts/build-client.mjs); run as .ts files, a
5+
Lines 94–101 at 318 (were 94–99 at 280)
97+ /** For tests: the command stamped as HOOK_COMMAND, instead of this client's own `abso hook`. */
98100
Lines 134–148 at 318 (were 132–137 at 280)
134136
137+/** Whether the installed abso mod hands a local project's edits to abso hook: it was installed with a HOOK_COMMAND. */
138+export function modHandsLocal(env: Readonly<Record<string, string | undefined>> = process.env): boolean {
140+ return /HOOK_COMMAND[^=\n]*=\s*\[/.test(readFileSync(at(skillsFolder(AVCS_MOD.name, env), STAMP_FILE), "utf8"));
145+
136147 * After the new mod is in, the folder it replaces (skills/avcs, skills/avcs-view) would load beside it, so it
137148 * is moved, not deleted, to ~/.abso/retired-mods/<name>-<stamp>. Returns where it went, or undefined when there was none.
Lines 237–247 at 318 (were 226–233 at 280)
228239
229−/** The files to install, stamped with `version`, in install order. */
230−function filesFor(spec: ModSpec, version: string): Map<string, Buffer> {
240+/** The command that runs this checkout's `abso hook`: what the mod hands a local project's edits to. */
241+export const hookCommand = (): readonly string[] => [process.execPath, join(CLIENT_DIR, "abso.ts"), "hook"];
242+
243+/** The files to install, stamped with `version` (and HOOK_COMMAND, where a stamp.ts has it), in install order. */
244+function filesFor(spec: ModSpec, version: string, hook: readonly string[] = hookCommand()): Map<string, Buffer> {
231245 if (!/^[\w.+-]+$/.test(version)) throw new Error(`can't stamp the version ${JSON.stringify(version)}`);
Lines 253–261 at 318 (were 239–245 at 280)
241255 if (stamped === text) throw new Error(`${rel} has no "STAMP ... = undefined" line to stamp`);
242− data = Buffer.from(stamped);
257+ stamped.replace(/(HOOK_COMMAND[^=\n]*=\s*)undefined/, (_, head: string) => head + JSON.stringify(hook)),
Lines 402–408 at 318 (were 386–392 at 280)
389− const next = filesFor(spec, version);
Lines 533–550 at 318 (were 517–523 at 280)
519535
520−/** `avcs --version`: this client, and the mods installed on this machine, compared with this client's. */
537+ * The command that runs one of this client's installers (client/install-mod.ts or install-view.ts), by its full
538+ * path. They are .ts files, which Node runs itself from 22.18, so on an older Node it says which one it needs.
544+ : `${command} (with Node 22.18 or later, which runs .ts files; this is Node ${process.versions.node})`;
546+
547+/** `abso --version`: this client, and the mods installed on this machine, compared with this client's. */
Lines 581–594 at 318 (were 554–567 at 280)
555582 // A built copy has no mod files to compare with or install from: it reports what is installed.
557− lines.push(`the ${m.name} mod: not installed${builtCopy() ? "" : ` (node client/${installer})`}`);
584+ lines.push(`the ${m.name} mod: not installed${builtCopy() ? "" : ` (${installerCommand(installer)})`}`);
564− : `; this client has ${m.current}: node client/${installer} installs it`;
Lines 606–611 at 318 (were 579–584 at 280)
579606 .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).`,
609+ `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).`,
Lines 28–34 at 318 (were 28–33 at 280)
3334
Lines 37–47 at 318 (were 36–41 at 280)
3637/** The folder, with its Api pointed at the Issues Worker: the token goes only where tokenGoesTo allows, as for the avcs server. */
3945 // An explicit --server goes to that server's own Issues Worker: ABSO_ISSUES_SERVER doesn't redirect it.
Lines 2–9 at 318 (were 2–9 at 280)
22
44import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
5−import { join, relative, resolve } from "node:path";
6−import { Api, ApiError } from "./api.ts";
Lines 16–24 at 318 (were 16–24 at 280)
19−import { CLIENT_DIR } from "./client-version.ts";
21−import { leftOutText, syncFolder, uploadBlobs } from "./commands.ts";
21+import { applyAnswer, leftOutText, pullAnswer, pullWritten, syncFolder, uploadBlobs } from "./commands.ts";
Lines 32–39 at 318 (were 32–38 at 280)
35−import { modInstalled } from "./install.ts";
3839import { projectFileName, readProjectFile, startingProjectFileText, writeStartingProjectFile } from "./project-file.ts";
Lines 102–149 at 318 (were 101–106 at 280)
103104
106+ * --local (abso init, abso join): the project's history is in a store on this machine, not on a server. The store is
107+ * --store, else ABSO_STORE, else the OS's data folder; one given with --store is kept in the folder's config.
109+function localFrom(args: Parsed, env: Env, command: string): { dir: string; settings: { store?: string } } | undefined {
118+ if (str(args, "org") !== undefined || bool(args, "public") || bool(args, "private") || bool(args, "reader"))
120+ `abso ${command} --local takes --project, --agent, --store and --as-is; a local project has no server to share it`,
126+
127+/** A store inside the project folder is left out of its files: a line in .absoignore. Its relative path, if so. */
141+
144+ return `It's a local project: its history is in ${join(dir, project)}, on this machine, and no server is needed.${ignored === undefined ? "" : ` .absoignore leaves the store, ${ignored}, out of the project's files.`}`;
146+
106149
Lines 154–214 at 318 (were 111–152 at 280)
157+ // Checked before any call: a name like ".." would otherwise go out as part of the request's path.
160+ `project names are letters, digits, dot, dash and underscore (got ${JSON.stringify(project)})`,
114162 if (bool(args, "public") && bool(args, "private")) throw new UsageError("--public or --private, not both");
115164 // A box signed in here, and no other credential asked for: the project is made as the person who approved the box,
116165 // the way the website makes one (abso 663). The token file only with --token-file, never by itself.
117− const server = serverFrom(args, env);
118− const box = readBox(server);
119− const credential = tokenCredential(args, env.env, server, root);
126− if (credential === undefined && tokenFile() !== undefined)
128177 `abso init signs in with this box's sign-in, and this box isn't signed in to ${server}: abso login signs it in. ${TOKEN_FILE_ASKED}`,
132− const config = makeSettings(args, env, project);
182+ ? { server: LOCAL, project, agent: agentFrom(args, str(args, "agent") ?? defaultAgentName()), ...local.settings }
135186 const wroteIgnore = !asIs && !existsSync(absoignore) && !existsSync(join(root, ".avcsignore"));
188+ // A store kept inside the project folder, like a virtual environment, isn't the project's files.
137190 // What the server runs on each new version (#39), guessed from package.json; recorded with the rest.
141− say(`Signing in with ${credential?.words ?? `no credential: nothing here signs in to ${server}`}.
195+ say(`Signing in with ${credential?.words ?? `no credential: nothing here signs in to ${server}`}.
143− 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− );
197+ const api = new Api({ ...config, ...(token ? { token } : {}), ...(local ? { localStore: local.dir } : {}) });
209+ if (typeof wroteProject !== "string") rmSync(join(root, projectFileName(root)), { force: true });
Lines 224–237 at 318 (were 162–173 at 280)
163225 ? ["Wrote a starting .absoignore (Claude Code state and operating system files); edit it like .gitignore."]
165− ...startingProjectFileText(wroteProject),
166229 ...(answer.skipped && answer.skipped.length > 0 ? [`The server skipped: ${answer.skipped.join(", ")}.`] : []),
170− hookHint(env.env),
Lines 242–248 at 318 (were 178–183 at 280)
Lines 416–431 at 318 (were 351–356 at 280)
353418
419+/** A join that failed before writing files: its state goes, but a key (already here, or made for it) stays for the next try. */
426+ for (const entry of readdirSync(dir)) if (entry !== "key") rmSync(join(dir, entry), { recursive: true, force: true });
428+
355430 if (args.positionals.length !== 1) throw new UsageError("join takes the project name: abso join <project>");
Lines 437–453 at 318 (were 362–375 at 280)
365− const server = serverFrom(args, env);
366− const box = readBox(server);
367− const hasKey = existsSync(join(stateDir(root), "key"));
368− const credential = tokenCredential(args, env.env, server, root);
440+ // A local project: no box, key or credential, and the agent is --agent or this computer's name.
372− if (str(args, "agent") !== undefined) {
Lines 472–511 at 318 (were 394–423 at 280)
397− const config = { server, project, agent, ...(reader ? { reader: true } : {}) };
475+ const config = { server, project, agent, ...(reader ? { reader: true } : {}), ...local?.settings };
402− const read = readConfig(root, env.env, false);
404− (env.writeErr ?? env.write)(
405− `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}`)}.
490+ `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}`)}.
407− );
409− let synced: Awaited<ReturnType<typeof syncFolder>>;
413498 // 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);
416503 if (!(error instanceof ApiError && error.status === 401 && !box && !settings.token)) throw error;
417− rmSync(stateDir(root), { recursive: true, force: true });
419505 throw new UsageError(!tokenFileAsked && tokenFile() !== undefined ? `${why} ${TOKEN_FILE_ASKED}` : why);
423511 `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.` : ""}`,
Lines 515–524 at 318 (were 427–435 at 280)
427515 `These files were already here and differ from shared, so they were left alone: ${synced.kept.join(", ")}. abso record sends them as your changes.`,
432− hookHint(env.env),
Lines 542–559 at 318 (were 453–460 at 280)
453542 : [`Nothing is installed yet. Before building or testing here, run ${projectFileName(root)}'s setup: ${setup}`];
455544
456−function 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.`;
546+ // A local project has no server: the mod hands its edits to abso hook, when it was installed with one to hand them to.
549+ return "Edits made by Claude Code here are recorded by the abso mod on this machine, through abso hook. Anything else: abso record.";
551+ return `abso record sends the edits made here: the abso mod on this machine is older than local projects. ${installerCommand("install-mod.ts")} updates it, and new chats load it.`;
555+ 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.";
558+ 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.`;
new file, 5 lines
2+export declare function handle(request: Request, env: unknown, ctx: unknown, issues: unknown): Promise<Response>;
5+export declare function issuesFetch(request: Request, env: unknown, ctx: unknown, route: unknown): Promise<Response>;
new file, 7 lines
1+// The open server's router, project object and issues, for local projects (local-store.ts). Plain JS, with its types
2+// in local-server.d.mts, so the client's typecheck stops here: server/src is typechecked with the Workers' types
4+
new file, 407 lines
1+// Local projects (abso init --local): the open server's own router and project object (server/src) run in this
2+// process, over Node's SQLite, so a project needs no server, account or network. Each project is one SQLite file in a
3+// store folder. Every call runs in one SQLite write transaction, which is the store's lock: another process's call
5+
12+
17+/** The shared token the in-process server is given, and that its calls carry. Not a secret: nothing listens. */
19+
21+
23+
25+ * Where local projects live: the folder's own store (--store, kept in its config), else ABSO_STORE, else the OS's
26+ * per-user data folder. Undefined when there is none to use (no data folder and nothing named), so nothing assumes a
29+export function storeDir(env: EnvMap, configured?: string, cwd = process.cwd()): string | undefined {
47+
49+ "there's no folder for local projects here: set ABSO_STORE to one, or give abso init --local a --store <folder>";
50+
51+// --- The Workers runtime's parts the server uses, over node:sqlite -----------------------------------------------
52+
63+
64+/** A Durable Object's storage: SQL, synchronous transactions, the key-value calls and the alarm, on one database. */
67+ "CREATE TABLE IF NOT EXISTS _local_kv (key TEXT PRIMARY KEY, value BLOB NOT NULL); CREATE TABLE IF NOT EXISTS _local_alarm (id INTEGER PRIMARY KEY CHECK (id = 0), at INTEGER)",
80+ const out = (v: unknown) => (v instanceof Uint8Array ? v.buffer.slice(v.byteOffset, v.byteOffset + v.byteLength) : v);
83+ const row = prepared("SELECT value FROM _local_kv WHERE key = ?").get(key) as { value: Uint8Array } | undefined;
88+ "INSERT INTO _local_kv (key, value) VALUES (?, ?) ON CONFLICT (key) DO UPDATE SET value = excluded.value",
91+ (prepared("DELETE FROM _local_kv WHERE key = ?").run(key) as { changes: number | bigint }).changes > 0;
97+ const rows = statement.columns().length > 0 ? statement.all(...args) : (statement.run(...args), []);
140+ rows.filter((r) => r.key.startsWith(options.prefix ?? "")).map((r) => [r.key, deserialize(r.value)]),
143+ // The alarm is kept, but nothing in a local project needs it: it pushes out to Artifacts, which is off here.
145+ const row = prepared("SELECT at FROM _local_alarm WHERE id = 0").get() as { at: number | null } | undefined;
149+ prepared("INSERT INTO _local_alarm (id, at) VALUES (0, ?) ON CONFLICT (id) DO UPDATE SET at = excluded.at").run(
159+
162+ // Through a cast: abso's worker compiles this file too (tool.lock.json), and its types have no globalThis.crypto.
186+
187+// --- Loading the server's code ------------------------------------------------------------------------------------
188+
194+ issuesFetch: (request: Request, env: unknown, ctx: unknown, route: unknown) => Promise<Response>;
197+
198+/** Node's SQLite says it's experimental on every start; that line would land in every local command's output. */
210+
211+export const NODE_TOO_OLD = `local projects need Node 22.13 or later, for its built-in SQLite; this is Node ${process.versions.node}`;
212+
223+ // Run as .ts files, the server's `import { DurableObject } from "cloudflare:workers"` needs a stand-in. A built
224+ // copy has it already: the build points the import at the same file (scripts/build-client.mjs).
229+ // The hook stays for the rest of the process: deregistering it crashes Node 24 at exit when the compile cache
241+ // Nothing is reached for here: a part of the client is missing (its packages not installed, say).
243+ `local projects couldn't load the server's code: ${e instanceof Error ? e.message : String(e)}`,
256+
259+
260+// --- One store, as a fetch -----------------------------------------------------------------------------------------
261+
266+ /** PRAGMA data_version when this process last used the project: it changes when another process writes. */
268+ /** The project's issues, asks and news: issues.sqlite beside it, opened when a call first reaches them. */
270+ /** The issues object for the call under way: made again for each call, as another process may have written. */
273+
276+
286+
287+/** A project's calls, and its issues, asks and news, which the open server keeps at /issues/p/<project>/. */
289+/** A project's name is also its folder in the store, so it never starts with a dot ("." and ".." would leave it). */
292+
294+ * The fetch a local folder's calls go through: each call is answered by the open server's router, in this process,
297+export function localFetch(dir: string): (input: string, init?: RequestInit) => Promise<Response> {
309+ db.exec("PRAGMA journal_mode = WAL; PRAGMA busy_timeout = 120000; PRAGMA synchronous = NORMAL");
338+ db.exec("PRAGMA journal_mode = WAL; PRAGMA busy_timeout = 120000; PRAGMA synchronous = NORMAL");
350+ // One call at a time, as a Durable Object takes them: a call holds its project's write transaction across awaits,
351+ // and the connection can't start a second (two calls at once come from Promise.all in ci and waiting --mine).
361+
369+ if (!NAME.test(name)) return json(400, { error: "project names use letters, digits, '.', '_' and '-'" });
376+ // Every call, issues ones too, holds the project file's lock, so local writers of the project and of its
381+ const version = (p.db.prepare("PRAGMA data_version").get() as { data_version: number }).data_version;
390+ // The answer is read whole before the write is kept, so a body that fails to arrive keeps nothing either.
Lines 1–8 at 318 (were 1–8 at 280)
33
4−import { readFileSync } from "node:fs";
5−import { resolve } from "node:path";
Lines 38–44 at 318 (were 38–44 at 280)
41−import { configPath, findRoot, installKey, isVisitor, readConfig, tokenFile } from "./config.ts";
41+import { configPath, findRoot, installKey, isVisitor, readConfig, runKey, tokenFile } from "./config.ts";
Lines 59–65 at 318 (were 59–64 at 280)
6161import { adminToken, adminTokenWords, issuedPublic, keyList, keyListText, keyNew, keyRevoke } from "./key-admin.ts";
Lines 74–85 at 318 (were 73–82 at 280)
8083
Lines 123–135 at 318 (were 120–130 at 280)
125− "abso init [folder] --project <name> [--agent <name>] [--as-is] [--org <org>] [--public|--private] [--token-file]",
130+ "abso init [folder] --project <name> [--agent <name>] [--as-is] [--org <org>] [--public|--private] [--token-file] | abso init [folder] --local --project <name> [--agent <name>] [--store <folder>] [--as-is]",
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.",
132+ "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. --local makes a local project instead: its history is kept on this machine, in a store folder, and no server, sign-in or network is needed (Node 22.13 or later). The store is --store <folder> (kept in the folder's settings; inside the folder, .absoignore leaves it out), else ABSO_STORE, else this user's data folder (%LOCALAPPDATA%\\abso\\store, ~/Library/Application Support/abso/store, or $XDG_DATA_HOME/abso/store). The agent is --agent, else this computer's name.",
Lines 145–151 at 318 (were 140–146 at 280)
141146 "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.",
148+ "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.",
Lines 213–244 at 318 (were 208–220 at 280)
213− "abso login [--no-browser] [--no-ask] [--projects <name,name>] [--role <reader|writer|owner>] [--days <1-90>]",
221+ "abso login [--no-browser] [--no-ask] [--projects <name,name>] [--role <reader|writer|owner>] [--days <1-90>] | abso login --web [--pat-file <file> [--site http://localhost:<port>]]",
215− "Sign this box in once: it opens the approve page in your browser with the code filled in, prints the link and the code too, and waits while a person approves the code on the website, choosing the projects, the highest role and how long. Then abso join in any of those projects gives each agent its own key, with no approval. The box's sign-in is kept in your user folder, never in a project folder, and is never printed. No browser opens with --no-browser or ABSO_NO_BROWSER, over SSH, under CI, or on Linux without a display. In an agent's folder on the same server, it also asks a person in that project to approve it (the person who approved the agent's box, else the project's owners), as an abso ask, so nobody has to relay the code; the box can then be granted that project at no more than the agent's own role. --no-ask shows the code only.",
223+ "Sign this box in once: it opens the approve page in your browser with the code filled in, prints the link and the code too, and waits while a person approves the code on the website, choosing the projects, the highest role and how long. Then abso join in any of those projects gives each agent its own key, with no approval. The box's sign-in is kept in your user folder, never in a project folder, and is never printed. No browser opens with --no-browser or ABSO_NO_BROWSER, over SSH, under CI, or on Linux without a display. In an agent's folder on the same server, it also asks a person in that project to approve it (the person who approved the agent's box, else the project's owners), as an abso ask, so nobody has to relay the code; the box can then be granted that project at no more than the agent's own role. --no-ask shows the code only. --web, on staging only, signs a browser in to the website instead: it prints a link that works once, within a minute, and signs whichever browser opens it in as the person who approved this box, but only to the projects the box was granted and at most as a writer, until the box is revoked or ends (or, with --pat-file, as the test account whose PAT that file holds, at most as a writer). It writes issues, replies, answers, groups and announcements, and changes no members, roles, visibility, keys, boxes or settings. The box's sign-in, the PAT and the session never appear. It goes only to the staging website beside this folder's staging server; any other server, prod included, is refused and nothing is sent. --site, with --pat-file only, points it at a website on this machine (http://localhost or 127.0.0.1).",
236+ throw new UsageError(`this box isn't signed in to ${server}: abso login first, or --pat-file <file>`);
Lines 350–368 at 318 (were 326–335 at 280)
329− flags: { server: "string", agent: "string", dir: "string", reader: "boolean", "token-file": "boolean" },
330− usage: "abso join <project> [--agent <name>] [--dir <folder>] [--reader] [--token-file]",
363+ "abso join <project> [--agent <name>] [--dir <folder>] [--reader] [--token-file] | abso join <project> --local [--agent <name>] [--store <folder>] [--dir <folder>]",
332− "Join a project as a new agent and write its shared files into a folder: --dir, else here when this folder is empty, else ./<project> (which has to be new or empty). Without --agent the agent is named after this box (the name abso login gave it, lower-cased), or the next free <name>-2, <name>-3; that needs the box signed in with abso login. --reader joins as a reader: it reads everything and records nothing, and the server refuses its edits, records and pushes. With --reader and no sign-in, a public project is joined to read signed out: the folder holds only its settings, sends no sign-in, and runs status, log, show, files, blame, why, where, issues, issue and search; every other command is refused. It says what it signs in with: a new key from this box's sign-in, the folder's key, or ABSO_TOKEN; this machine's ~/.abso/token only with --token-file, never unasked.",
365+ "Join a project as a new agent and write its shared files into a folder: --dir, else here when this folder is empty, else ./<project> (which has to be new or empty). Without --agent the agent is named after this box (the name abso login gave it, lower-cased), or the next free <name>-2, <name>-3; that needs the box signed in with abso login. --reader joins as a reader: it reads everything and records nothing, and the server refuses its edits, records and pushes. With --reader and no sign-in, a public project is joined to read signed out: the folder holds only its settings, sends no sign-in, and runs status, log, show, files, blame, why, where, issues, issue and search; every other command is refused. It says what it signs in with: a new key from this box's sign-in, the folder's key, or ABSO_TOKEN; this machine's ~/.abso/token only with --token-file, never unasked. --local joins a local project (abso init --local) from the same store: --store, else ABSO_STORE, else this user's data folder; the agent is --agent, else this computer's name.",
Lines 385–391 at 318 (were 352–358 at 280)
353386 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.',
388+ '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.',
Lines 433–439 at 318 (were 400–406 at 280)
401434 '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.",
436+ "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.",
Lines 648–654 at 318 (were 615–621 at 280)
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.",
651+ "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.",
Lines 674–680 at 318 (were 641–647 at 280)
642675 '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.",
677+ "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.",
Lines 890–896 at 318 (were 857–863 at 280)
858891 "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.",
893+ "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.",
Lines 995–1010 at 318 (were 962–975 at 280)
963996
964997/** 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 {
968− return root
969− ? readConfig(root, env.env, tokenFileAsked).token !== undefined
970− : (fromEnv(env.env, "TOKEN") ?? (tokenFileAsked ? tokenFile() : undefined)) !== undefined;
1005+ return tokenFileAsked && tokenFile() !== undefined ? "the token file, ~/.abso/token" : undefined;
972− return false;
9751010
Lines 1021–1035 at 318 (were 986–991 at 280)
9871022
1031+
Lines 1123–1129 at 318 (were 1079–1085 at 280)
10801124 const code = err instanceof UsageError ? "usage" : err instanceof ApiError ? "server" : "error";
1082− plainError(err, carriesCredential(env, asked), !asked && tokenFile() !== undefined) ??
Lines 15–30 at 318 (were 15–23 at 280)
18− readonly expiresAt: number;
2021
22+/** A ticket's expiry in milliseconds, whichever form the server sent; now when it can't be read. */
24+ const at = typeof ticket.expiresAt === "number" ? ticket.expiresAt : Date.parse(ticket.expiresAt);
27+
2330
Lines 43–49 at 318 (were 36–42 at 280)
3643
3845export function streamText(ticket: NewsTicket, project: string, agent: string, now = Date.now()): string {
39− const seconds = Math.max(0, Math.round((ticket.expiresAt - now) / 1000));
4148 `Open this with Monitor within ${seconds} seconds (the ticket opens ${agent}'s news stream once). When the Monitor ends or the socket closes, run abso news --stream again; the new socket sends what arrived in between.`,
Lines 55–61 at 318 (were 48–54 at 280)
4855
4956/** How long --stream's mark holds: the Monitor's 30 minutes, and the minute the ticket waits to be used. */
51− return Math.max(now, ticket.expiresAt) + MONITOR_TIMEOUT_MS;
5360
Lines 94–101 at 318 (were 87–92 at 280)
97+ /** Reads the seat's news, marking it heard (POST news); a frame calls it. Without it, frames are printed as they come. */
9099 /** Called when a socket opens and at each ping: the stream is held until the next ping is due, and a little more. */
Lines 109–163 at 318 (were 100–109 at 280)
101110
112+ * A frame is a wake (abso 690): on one, read the seat's news (which marks it heard) and print what that answers, one
113+ * read at a time, with frames that arrive meanwhile folded into one more read. When the read answers nothing (a server
114+ * that counts a frame as heard already, or another chat on the seat took it first), the frames themselves are printed.
136+ deps.note(`(abso news --follow: couldn't read the news: ${(err as Error).message}; showing the frames)`);
139+ // A frame the read didn't cover still shows: on a server that counts a frame as heard, its item never comes back
140+ // from the read. A catch-up frame names several items, so a frame holding a shown item counts as covered.
141+ for (const frame of these) if (!shown.some((line) => frame.includes(line) || line.includes(frame))) show(frame);
154+
103156 * Holds the seat's stream, printing one line per item, until the key is refused or `stopped()`.
106159export async function follow(deps: FollowDeps): Promise<{ ended: "refused" | "stopped"; reason: string }> {
Lines 186–198 at 318 (were 132–143 at 280)
135− deps.write(e.data);
140− done({ code: e.code, reason: e.reason });
143198 if (isRefusal(closed.code)) return { ended: "refused", reason: closed.reason || `closed ${closed.code}` };
Lines 6–12 at 318 (were 6–11 at 280)
1011
1112/** abso serve [--version N]: a preview of one version of shared at a stable URL, built once on the server (#37). */
Lines 330–344 at 318 (were 329–342 at 280)
332− void root;
335335 const png = gz === null ? undefined : untarGz(gz).find((e) => e.path === `.abso-shot/${name}`);
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);
Lines 40–46 at 318 (were 40–45 at 280)
Lines 326–336 at 318 (were 325–333 at 280)
325326 const space = (draft: string | null | undefined): string => (draft ? `draft ${draft}` : "shared");
328− const behind = await newerClientNote(config.server);
330− `Project ${config.project}: shared is at version ${status.version}. This folder is ${config.agent}${config.reader || me?.reader ? ", a reader (it records and pushes nothing)" : ""}, working in ${space(me?.draft)}.${config.follow ? ` It follows label ${config.follow}: pulls take it to the newest version with that label.` : ""} Signed in with ${credential.kind}${credential.id ? ` ${credential.id}` : ""}.`,
333+ `Project ${config.project}: shared is at version ${status.version}. This folder is ${config.agent}${config.reader || me?.reader ? ", a reader (it records and pushes nothing)" : ""}, working in ${space(me?.draft)}.${config.follow ? ` It follows label ${config.follow}: pulls take it to the newest version with that label.` : ""}${localProject ? ` It's a local project, in ${join(config.localStore ?? "", config.project)}.` : ` Signed in with ${credential.kind}${credential.id ? ` ${credential.id}` : ""}.`}`,
new file, 141 lines
1+// abso login --web: a staging website session for the person a box is signed in as, opened in an agent's own browser, with
2+// no secret in the agent's hands. The website's /login/handoff takes this box's sign-in (or a test account's PAT, from a file)
3+// and answers a one-use link that works for a minute; opening it signs that browser in. Only the link is printed: never the
5+
8+
9+/** The website beside each staging server. Prod has none here: agents never sign in to the website on prod. */
11+ "https://abso-staging.chrisazy.workers.dev": "https://abso-website-staging.chrisazy.workers.dev",
12+ "https://avcs-staging.chrisazy.workers.dev": "https://abso-website-staging.chrisazy.workers.dev",
14+
15+/** What the website answers: the link, when it stops working, and who and until when it signs in. */
23+
25+ * The website a handoff's credential goes to (Security condition 6, Code Review): the staging website beside the folder's own
26+ * staging server, from the fixed list above, and never an origin from a flag. A server that isn't on the list is refused,
27+ * prod included. --site is only for a test account's PAT on this machine (http://localhost or 127.0.0.1); a box's sign-in
35+ `abso login --web is for staging: ${origin} has no staging website beside it that abso knows, and agents never sign in to the website on prod. Nothing was sent.`,
39+ throw new UsageError(`--site isn't taken with a box's sign-in, which goes only to ${known}. Nothing was sent.`);
46+ if (url === null || url.protocol !== "http:" || (url.hostname !== "localhost" && url.hostname !== "127.0.0.1"))
48+ "--site, with --pat-file, names this machine only (http://localhost:<port> or http://127.0.0.1:<port>). Nothing was sent.",
52+
54+ * abso login --web: where the credential would go is settled before it is read, so a refusal reads and sends nothing
55+ * (Security). `credential` reads the box's sign-in or the PAT only once the website is one it may go to.
68+
81+
86+
87+/** Asks the website for a handoff link with `credential` (a box sign-in or a PAT) in Authorization. */
88+export async function webHandoff(site: string, credential: string, fetcher: typeof fetch = fetch): Promise<Handoff> {
98+ throw new UsageError(`couldn't reach ${site}: ${scrubbed((err as Error).message, credential)}`);
130+
131+/** What abso login --web says: the one link, how long it works, who it signs in as, and what it reaches (Security). */
135+ ? "only to the projects this box was granted, at most as a writer, until the box is revoked or ends"
138+ `Open this link in your browser within ${seconds} seconds. It signs that browser in to ${site} as ${h.name}, until ${h.sessionEnds}, and works once. It reaches ${reach}:`,
Lines 15–23 at 318 (were 15–20 at 280)
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.';
1821
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) =>
Lines 43–56 at 318 (were 40–49 at 280)
4245
43− it("--file gives ask's question, answer'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"]);
Lines 3–25 at 318 (were 3–11 at 280)
44import { CALLER_HEADER, CALLER_MAX, callerHeader, callerPlace, parseCaller } from "../../src/caller.ts";
67
89
18+ assert.equal(parseCaller(callerFor(session, "DESKTOP-1", "/x/groups"))!.session, caller.session);
22+
1024 const header = callerHeader({ session, machine: "DESKTOP-1", folder: "C:\\Users\\sam\\repos\\abso\\groups" })!;
new file, 60 lines
1+// abso ci for a project whose CI is its pipeline file (abso 719): test-byoc on 2026-10-16 had no abso.json, and abso ci
2+// said "nothing to run" while its abso.yml's run 8 was going. The stored run is the project's CI there.
3+
7+
15+
32+
44+ "Pipeline run 2 (abso.yml) was planned, not run, on version 1. abso pipeline runs 2 shows its jobs.",
47+
48+test("only the built-in check's own nothing to run is set aside, never a red or another skip", () => {
50+ assert.equal(builtInHasNothing({ ...base, skipped: { ...nothing, reason: "CI is off" } }), false);
Lines 211–235 at 318 (were 211–231 at 280)
211211
212212test("plainError words a refusal by whether a credential went, and a server that can't be reached", () => {
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>.");
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− 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);
230234
231235test("whoami with nothing named shows prod, and names the other servers this box is signed in to", async () => {
new file, 60 lines
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).
3+
10+
14+
19+
25+
29+
33+ writeFileSync(join(dir, "package.json"), `${JSON.stringify({ scripts: { test: "node --test" } })}\n`);
37+
40+ assert.notEqual(await run(dir, "join", "p", "--server", DOWN, "--agent", "a", "--dir", dir), 0);
43+
49+ assert.notEqual(await run(dir, "join", "p", "--server", DOWN, "--agent", "a", "--dir", dir), 0);
52+
57+ assert.notEqual(await run(dir, "join", "p", "--server", DOWN, "--agent", "a", "--dir", dir), 0);
Lines 26–33 at 318 (were 26–31 at 280)
Lines 115–142 at 318 (were 113–118 at 280)
115117
118+ it("stamps the command that runs this client's abso hook, where stamp.ts has a HOOK_COMMAND line", () => {
121+ "export const STAMP: string | undefined = undefined\nexport const HOOK_COMMAND: readonly string[] | undefined = undefined\n",
133+ 'export const HOOK_COMMAND: readonly string[] | undefined = ["C:\\\\node.exe","C:\\\\abso\\\\client\\\\abso.ts","hook"]\n',
139+
Lines 451–460 at 318 (were 427–435 at 280)
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$/,
454+ /^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)");
457+ assert.equal(view, `the abso-view mod: not installed (${installerCommand("install-view.ts")})`);
434459 (await main(["--version", "--json"], { cwd: config, env: { CLAUDE_CONFIG_DIR: config }, write: () => {} }))
Lines 499–505 at 318 (were 474–480 at 280)
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).`,
502+ `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).`,
new file, 222 lines
1+// Local projects (abso init --local): a project whose history is in a store on this machine, answered by the open
2+// server's own code in the client's process. Every test here runs with fetch replaced by one that throws, so any
4+
7+import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
15+
22+
36+
38+const env = () => ({ ABSO_STORE: store, ABSO_SERVERS_FILE: "no-servers.json", ABSO_HOOK_FORCE: "1" });
39+async function run(cwd: string, ...argv: string[]): Promise<{ exit: number; out: string; err: string }> {
44+
45+/** A copy of the client without the open server beside it (a platform that pins only client/) has no local projects to test. */
46+const noServer = existsSync(fileURLToPath(new URL("../../server/src/router.ts", import.meta.url)))
49+
56+
62+ assert.match(r.out, /Created project demo at version 0 from 2 text files/, "a.txt and the starting .absoignore");
69+ assert.equal(config.store, undefined, "the store came from ABSO_STORE, so the folder doesn't name it");
71+
83+
96+
103+
113+
136+
140+ const answers = await Promise.all([local(`${LOCAL_BASE}/p/demo/queue`), local(`${LOCAL_BASE}/p/demo/queue`)]);
144+
145+ it("a project's name can't start with a dot, so its folder stays inside the store", async () => {
158+
160+ it("--store inside the folder is kept in its settings and left out of its files", async () => {
164+ const r = await run(dir, "init", "--local", "--project", "beside", "--agent", "a", "--store", ".abso-store");
167+ assert.equal(JSON.parse(readFileSync(join(stateDir(dir), "config.json"), "utf8")).store, join(dir, ".abso-store"));
174+
178+ const both = await run(dir, "init", "--local", "--server", "https://abso.test", "--project", "p");
183+
193+
195+ // The way people and agents run them: client/abso.ts, a process per command, Node's compile cache as it is.
203+
217+ assert.equal(r.status, 0, `${name}: exit ${r.status} ${r.signal ?? ""}\n${r.stdout}${r.stderr}`);
Lines 3–9 at 318 (were 3–8 at 280)
Lines 42–52 at 318 (were 41–46 at 280)
45+ // The server sends the expiry as an ISO time (staging 1418); the countdown and the stream mark read it the same.
4551
4652test("a refusal close stops --follow; any other close opens again, waiting 1 s doubling to a minute", () => {
Lines 134–182 at 318 (were 128–133 at 280)
130136
137+test("a frame is a wake: --follow reads the news and prints that once; an empty read prints the frames", async () => {
138+ // The server's frames don't count as heard (abso 690): the read takes them, so each item prints once.
139+ const w = world([{ frames: ["fe told you: hello", "cloud asks: ship it?"], close: { code: 1006 } }]);
147+ // Two frames, one read in flight: the second folds into one more read, which finds nothing new; its frame was
151+
152+ // A server that counts a frame as heard already (staging 1418): the read is empty, so the frame is what shows.
157+
158+ // On that server a read can find other news waiting: the frame's own item still shows (Code Review, 291).
163+
164+ // A catch-up frame names the first few waiting items and how many more: the read shows them all, the frame adds nothing.
165+ const catchUp = world([{ frames: ["fe told you: hello\ncloud: ship it?\nand 1 more"], close: { code: 1006 } }]);
169+
179+
131180test("--follow keeps an idle socket open with a ping the object answers without waking", async () => {
new file, 106 lines
1+// abso login --web: a staging website session handed to a browser as a one-use link, with no secret printed.
2+
9+
15+
16+test("the credential goes only to the staging website beside the folder's staging server (Security condition 6)", () => {
24+ assert.throws(() => siteFor("https://api.abso.dev", "http://localhost:8871", "pat"), /for staging/);
27+ assert.throws(() => siteFor(STAGING, "http://localhost:8871", "box"), /isn't taken with a box's sign-in/);
31+ for (const elsewhere of ["https://anywhere.example", SITE, "https://localhost:8871", "not a url"])
34+
37+ const fetcher = (async (url: string) => (sent.push(url), Response.json({}))) as unknown as typeof fetch;
47+ await assert.rejects(webLogin({ ...asked, credential, fetcher }), /Nothing was sent/, JSON.stringify(asked));
51+ await webLogin({ server: STAGING, site: undefined, kind: "pat", credential: () => PAT, fetcher }).catch(() => {});
54+
55+test("the credential goes in Authorization only, and the answer is the one link and who it signs in as", async () => {
58+ seen.push({ url, authorization: new Headers(init.headers).get("authorization"), body: init.body ?? null });
68+ assert.deepEqual(seen, [{ url: `${SITE}/login/handoff`, authorization: `Bearer ${BOX}`, body: null }]);
77+
78+test("a refusal says why without the credential; an answer that isn't the site's own link is refused", async () => {
80+ Response.json({ error: `that key was refused: ${BOX}` }, { status: 401 })) as unknown as typeof fetch;
86+ const off = (async () => Response.json({ error: "not found" }, { status: 404 })) as unknown as typeof fetch;
96+
- MCP
- compare on this site's /mcp
- CLI
- abso diff 280 318 client --json
- JSON
- /christopher/abso-core/compare/280..318?file=client&format=json