Versions 281 to 318
Lines 107–114 at 318 (were 107–112 at 281)
Lines 20–26 at 318 (were 20–25 at 281)
Lines 69–75 at 318 (were 68–73 at 281)
7274
Lines 193–205 at 318 (were 191–199 at 281)
192194
194− return `${server.replace(/\/+$/, "")}/p/${encodeURIComponent(this.config.project)}${path}`;
196199
202+
Lines 220–231 at 318 (were 214–219 at 281)
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 281)
Lines 1017–1023 at 318 (were 1003–1009 at 281)
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 80–122 at 318 (were 80–85 at 281)
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 281)
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 281)
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 281)
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 281)
1212import { type MachineServers, machineServers, TOKEN_SERVERS, tokenGoesTo, trustedList } from "./core.ts";
1516
Lines 28–41 at 318 (were 27–36 at 281)
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 281)
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 281)
275284
278− const { server, project, agent, follow, reader, visitor } = settings;
281− : { server, project, agent, ...(follow ? { follow } : {}), ...(reader ? { reader: true } : {}) };
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 281)
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 281)
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 281)
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 281)
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 281)
389− const next = filesFor(spec, version);
Lines 28–34 at 318 (were 28–33 at 281)
3334
Lines 37–47 at 318 (were 36–41 at 281)
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–8 at 318 (were 2–8 at 281)
22
44import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
5−import { join, relative, resolve } from "node:path";
Lines 32–39 at 318 (were 32–38 at 281)
35−import { installerCommand, modInstalled } from "./install.ts";
3839import { projectFileName, readProjectFile, startingProjectFileText, writeStartingProjectFile } from "./project-file.ts";
Lines 102–149 at 318 (were 101–106 at 281)
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–200 at 318 (were 111–146 at 281)
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 } : {}) });
197+ const api = new Api({ ...config, ...(token ? { token } : {}), ...(local ? { localStore: local.dir } : {}) });
Lines 224–237 at 318 (were 170–181 at 281)
171225 ? ["Wrote a starting .absoignore (Claude Code state and operating system files); edit it like .gitignore."]
173− ...startingProjectFileText(wroteProject),
174229 ...(answer.skipped && answer.skipped.length > 0 ? [`The server skipped: ${answer.skipped.join(", ")}.`] : []),
178− hookHint(env.env),
Lines 242–248 at 318 (were 186–191 at 281)
Lines 437–453 at 318 (were 380–393 at 281)
383− const server = serverFrom(args, env);
384− const box = readBox(server);
385− const hasKey = existsSync(join(stateDir(root), "key"));
386− 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.
390− if (str(args, "agent") !== undefined) {
Lines 472–478 at 318 (were 412–418 at 281)
415− const config = { server, project, agent, ...(reader ? { reader: true } : {}) };
475+ const config = { server, project, agent, ...(reader ? { reader: true } : {}), ...local?.settings };
Lines 485–495 at 318 (were 425–434 at 281)
428− (env.writeErr ?? env.write)(
429− `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}`)}.
431− );
Lines 515–524 at 318 (were 454–462 at 281)
454515 `These files were already here and differ from shared, so they were left alone: ${synced.kept.join(", ")}. abso record sends them as your changes.`,
459− hookHint(env.env),
Lines 542–556 at 318 (were 480–486 at 281)
480542 : [`Nothing is installed yet. Before building or testing here, run ${projectFileName(root)}'s setup: ${setup}`];
482544
483−function hookHint(env: Readonly<Record<string, string | undefined>>): string {
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.`;
485555 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.";
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 59–65 at 318 (were 59–64 at 281)
6161import { adminToken, adminTokenWords, issuedPublic, keyList, keyListText, keyNew, keyRevoke } from "./key-admin.ts";
Lines 79–85 at 318 (were 78–83 at 281)
8183
Lines 123–135 at 318 (were 121–131 at 281)
126− "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]",
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.",
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 213–244 at 318 (were 209–221 at 281)
214− "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>]]",
216− "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 327–336 at 281)
330− flags: { server: "string", agent: "string", dir: "string", reader: "boolean", "token-file": "boolean" },
331− 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>]",
333− "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 1021–1035 at 318 (were 989–994 at 281)
9901022
1031+
Lines 15–30 at 318 (were 15–23 at 281)
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 281)
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 281)
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 281)
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 281)
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 281)
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 40–46 at 318 (were 40–45 at 281)
Lines 326–336 at 318 (were 325–333 at 281)
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}:`,
- MCP
- compare on this site's /mcp
- CLI
- abso diff 281 318 client/src --json
- JSON
- /christopher/abso-core/compare/281..318?file=client%2Fsrc&format=json