Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed
MCP
blame on this site's /mcp
CLI
abso blame client/src/api.ts --version 243 --json
JSON
/christopher/abso-core/blame/client/src/api.ts?version=243&format=json
1,012 linesFirst import 70% · pinch 23% · autosettle 2% · devops 2% · codex-prose-authorship-1 1% · candidates 1% · Last change autosettle in version 223,

1,012 lines from 24 changes in 24 versions.

init0Start the project1// Calls to the server's HTTP API (docs/v2-slice1.md). Every call is JSON
2// except `run`, which sends a tar.gz and reads the answer as a stream of JSON
3// lines (box-run.ts).
4
codex-capacity-chair162Add reviewed disk-first history and indexed graph storage for core issue 16; retain runtime activation gateCompare5import { randomUUID } from "node:crypto";
init0Start the project6import { setDefaultResultOrder } from "node:dns";
7import type {
8 ChangeAnswer,
9 DraftSyncAnswer,
10 EditAnswer,
11 EditBody,
12 News,
13 NoteAnswer,
14 NoteBody,
15 PublishAnswer,
16 RecordAnswer,
17 StatusAnswer,
18 SwitchAnswer,
19 SyncAnswer,
20} from "./api-answers.ts";
21import { ApiError, errorSentence, neverSent } from "./api-error.ts";
autosettle220abso autosettle: see or change what the server does with a held push (abso-core 23) abso autosettle says the project's choice: Off, Advise, or Settle at a confidence. It also says when the gate is stopped and who changed it last. abso autosettle off|advise|settle [--at 0.3-0.95] changes it, which takes the owner's key (on staging, the shared token too); without --at the server keeps its own. On a server with no choice per project (the open server), it says the operator's AUTOSETTLE decides. A visitor folder refuses it. Tried on project abso's Worker run locally (read, settle --at 0.7, advise, a bad word, --at 2) and on the open server. Tests: autosettle-command (words), visitor (the allow-list), typecheck clean.Compare22import type { AutosettleAnswer, AutosettleMode } from "./autosettle-commands.ts";
init0Start the project23import {
24 boxQuery,
25 consumeRun,
26 follow,
27 followUrl,
28 type PrepAnswer,
29 postRun,
30 RECONNECT_DELAYS_MS,
31 RUN_START_RETRY_MS,
32 type RunIO,
33 type RunKind,
34 type ServeAnswer,
35} from "./box-run.ts";
36import type { CiJob, CiStatus, QueueState } from "./ci-answers.ts";
37import { clientVersion } from "./client-version.ts";
38import type { Config } from "./config.ts";
39import type {
40 BlameAnswer,
41 DiffAnswer,
42 DropAnswer,
43 FileChange,
44 FilesAnswer,
45 LogAnswer,
46 Overlap,
47 PluckAnswer,
48 RestoreAnswer,
49 ShowAnswer,
50 View,
51 Where,
52 WhereAnswer,
53 WhyAnswer,
candidates186Read a version of shared without some earlier versions: abso show <N> --without A,B shows what differs and abso export <dir> --version N --without A,B writes the files. The server's GET without?version=&versions= checks the set left exactly as asked: when a version it keeps builds on one left out, it refuses with that chain, the files and the wider set that works, and never widens it. Atoms keep their ids and authors; shared and its log don't change; the same ask gives the same tree hash.Compare54 WithoutAnswer,
init0Start the project55} from "./history-answers.ts";
devops20Add abso search: find a project's issues by words or meaning `abso search "<words>" [--limit <N>]` lists the project's issues that match, best first, and is served as an MCP tool as well. - Each hit shows the issue, then where it matched: the title, the description, a comment, or "by meaning". - "#N" or "N" puts issue N first. - Where the server also searches by meaning, an issue worded unlike the search still turns up; the hit says so.Compare56import type {
57 Ask,
58 Attachment,
59 Draft,
60 DraftBody,
61 News as IssueNews,
62 IssuePage,
63 IssueRow,
64 IssueSearchHit,
65} from "./issues-wire.ts";
init0Start the project66import type { Modes } from "./modes.ts";
68export * from "./api-answers.ts";
69export { ApiError, neverSent } from "./api-error.ts";
70export {
71 type PrepAnswer,
72 RECONNECT_DELAYS_MS,
73 RUN_START_RETRY_MS,
74 type RunIO,
75 type RunKind,
76 type ServeAnswer,
77} from "./box-run.ts";
78export * from "./ci-answers.ts";
79export * from "./history-answers.ts";
devops20Add abso search: find a project's issues by words or meaning `abso search "<words>" [--limit <N>]` lists the project's issues that match, best first, and is served as an MCP tool as well. - Each hit shows the issue, then where it matched: the title, the description, a comment, or "by meaning". - "#N" or "N" puts issue N first. - Where the server also searches by meaning, an issue worded unlike the search still turns up; the hit says so.Compare80export type { Ask, Attachment, Draft, DraftBody, IssueNews, IssuePage, IssueRow, IssueSearchHit };
init0Start the project81
82/**
83 * How long a call may take: the base, plus 1 s for each 100 KB it sends
84 * (abso issue 34: a sync that recorded 191 reformatted files first ran out of
85 * its 30 s while the server was still taking them in).
86 */
87export function timeoutFor(baseMs: number, sent: string | undefined): number {
88 return sent === undefined ? baseMs : baseMs + Math.floor(Buffer.byteLength(sent) / 100_000) * 1000;
pinch26Publish and log fixes, and a flaky test removed. - A publish or a land now waits up to 150 s for the server's answer, not 30 s. The server may work on one request for up to 2 minutes, so a slow merge was reported as failed and then landed. - abso log reads any length of history. The server sends at most 200 versions a page, and the client now follows its pages: -n 2000 gives 2000, and --since or a folder reads up to 1000. abso log --before <version> starts below that version. The end of the list names the --before for the next older ones, and a filtered read says when it stopped short. - The test 'sends one run, and takes each command as one quoted word' is removed: it failed on Windows about half the time. The stand-in server the client tests use no longer closes idle kept-alive connections, which other tests also tripped on under load (ECONNRESET). Check: 722 pass, 0 fail.Compare91/**
92 * How long a publish or a land may take before the client stops waiting: the
93 * server gives one request up to 2 minutes of work, so a small body can still
94 * take that long (a large merge). Waiting less reported publishes as failed
95 * that went on to land.
96 */
97export const PUBLISH_TIMEOUT_MS = 150_000;
99/** The most versions the server's log sends at once. */
100export const LOG_PAGE = 200;
init0Start the project102/** A query string from the values that are set (null and undefined are left out). */
103function query(values: Record<string, string | number | null | undefined>): URLSearchParams {
104 const q = new URLSearchParams();
105 for (const [k, v] of Object.entries(values)) if (v !== null && v !== undefined) q.set(k, String(v));
106 return q;
109export function newsLines(news: News): string[] {
110 if (news === undefined || news === null) return [];
111 return (typeof news === "string" ? [news] : [...news]).filter((s) => typeof s === "string" && s.trim() !== "");
pinch23abso issue <N> --copy-to <project>: copy an issue into another project, with its comments, answered asks and labels, each keeping its author and time. The Issues server reads the source issue itself; the client sends only which issue, and any cleaned texts. - --dry-run shows what the copy would make (title, how many comments and asks, which were edited, labels) and what's left behind. It writes nothing. - --clean <file> gives cleaned texts by source id, as JSON: {title, description, comments: [{id, text}], asks: [{id, question, answer}]}. A comment left out of a given list isn't copied. - --copy-to goes alone, so a copy is never half an edit. Copying into the project the issue is already in is refused before any call. - When a live server refuses the copy (copying out of a project there takes an owner of it), the message says --dry-run still works. - The MCP issue tool's clean input is a file too, so it's confined to the server's start folder like attach. Tests: client/test/issues.test.ts, against a stand-in Issues server. The run --parallel test that sometimes times out under a full run passed when rerun.Compare114/** An issue copy's request: the source, and any texts given cleaned, by their source ids. */
115export interface CopyBody {
116 from: string;
117 issue: number;
118 title?: string;
119 description?: string;
120 comments?: { id: number; text?: string }[];
121 asks?: { id: number; question?: string; answer?: string }[];
124/** What a copy writes, as a dry run answers it. */
125export interface CopyPlan {
126 from: { project: string; issue: number };
127 title: string;
128 edited: ("title" | "description")[];
129 labels: string[];
130 closed: { how: "done" | "dropped" } | null;
131 comments: { edited: boolean }[];
132 asks: { edited: boolean }[];
133 skipped: { comments: number[]; asks: number[] };
136export type CopyAnswer =
137 | { dryRun: true; plan: CopyPlan }
138 | { ok: true; id: number; from: { project: string; issue: number }; skipped: { comments: number[]; asks: number[] } };
init0Start the project140export class Api {
141 readonly config: Config;
142 readonly timeoutMs: number;
144 /** Waits between tries when a run's stream breaks; tests shorten them. */
145 readonly reconnectDelaysMs: readonly number[];
146 readonly startRetryDelaysMs: readonly number[];
review27Client: ABSO_ environment names (AVCS_ still read), .absoignore (.avcsignore still read), .abso-export.json, shot files; READMEs say abso (abso 224)Compare147 /** Another box of this agent for run, logs and fetch (--box or ABSO_BOX, #37); undefined is its own box. */
init0Start the project148 box: string | undefined;
150 constructor(
151 config: Config,
152 timeoutMs = 30_000,
153 reconnectDelaysMs: readonly number[] = RECONNECT_DELAYS_MS,
154 startRetryDelaysMs: readonly number[] = RUN_START_RETRY_MS,
155 ) {
156 this.config = config;
157 this.timeoutMs = timeoutMs;
158 this.reconnectDelaysMs = reconnectDelaysMs;
159 this.startRetryDelaysMs = startRetryDelaysMs;
160 }
pinch54The client and the edit mods send and read X-Abso-* headers only (Client, Name, Run-Key, Kind, Admin; Run, Box, Prep from answers). Servers have read X-Abso-* beside the old names for a while and answer under both, so this works with any current server.Compare162 /** What a box run is for, for the server's box-run records (#39): X-Abso-Kind on POST /run. */
init0Start the project163 runKind: RunKind = "run";
165 /** The Issues Worker (#54) this folder's issues calls go to; set by the issues commands (issues.ts). */
166 issuesServer: string | undefined;
168 url(path: string, server = this.config.server): string {
169 return `${server.replace(/\/+$/, "")}/p/${encodeURIComponent(this.config.project)}${path}`;
170 }
172 agentPath(action: string): string {
173 return `/a/${encodeURIComponent(this.config.agent)}/${action}`;
174 }
176 headers(contentType?: string): Record<string, string> {
177 return {
178 // Which client made the call (#29); the mods send theirs too.
pinch54The client and the edit mods send and read X-Abso-* headers only (Client, Name, Run-Key, Kind, Admin; Run, Box, Prep from answers). Servers have read X-Abso-* beside the old names for a while and answer under both, so this works with any current server.Compare179 "x-abso-client": `abso-cli/${clientVersion()}`,
pinch86Read a public project signed out: abso join <project> --reader with no sign-in makes a folder that reads it. The folder holds only its settings (server, project, visitor), sends no sign-in whatever the environment or the box holds, follows no redirect, and runs status, log, show, files, blame, why, where, issues, issue and search; every other command is refused before any call, from an allow-list a new command has to join. join answers a private project and a missing one alike, by the status answer's code alone. Tests in client/test/visitor.test.ts.Compare180 ...(this.config.token && !this.config.visitor ? { authorization: `Bearer ${this.config.token}` } : {}),
init0Start the project181 ...(contentType ? { "content-type": contentType } : {}),
182 };
183 }
pinch88Every request a folder's Api makes goes through one send(): a folder that reads signed out sends only GETs and follows no redirect on every path, box runs and serve included.Compare185 /**
186 * Every request this Api makes goes through here. In a visitor folder it never sends anything but a GET,
187 * and follows no redirect, so nothing it sends goes anywhere it didn't name (headers() adds no sign-in).
188 */
189 send(url: string, init: RequestInit = {}): Promise<Response> {
190 if (!this.config.visitor) return fetch(url, init);
191 if ((init.method ?? "GET") !== "GET")
192 return Promise.reject(new ApiError("a folder that reads signed out sends only reads"));
193 return fetch(url, { ...init, redirect: "error" });
194 }
pinch26Publish and log fixes, and a flaky test removed. - A publish or a land now waits up to 150 s for the server's answer, not 30 s. The server may work on one request for up to 2 minutes, so a slow merge was reported as failed and then landed. - abso log reads any length of history. The server sends at most 200 versions a page, and the client now follows its pages: -n 2000 gives 2000, and --since or a folder reads up to 1000. abso log --before <version> starts below that version. The end of the list names the --before for the next older ones, and a filtered read says when it stopped short. - The test 'sends one run, and takes each command as one quoted word' is removed: it failed on Windows about half the time. The stand-in server the client tests use no longer closes idle kept-alive connections, which other tests also tripped on under load (ECONNRESET). Check: 722 pass, 0 fail.Compare196 async json<T>(
197 method: "GET" | "POST",
198 path: string,
199 body?: unknown,
200 server = this.config.server,
201 atLeastMs = 0,
202 ): Promise<T> {
init0Start the project203 let res: Response | undefined;
pinch88Every request a folder's Api makes goes through one send(): a folder that reads signed out sends only GETs and follows no redirect on every path, box runs and serve included.Compare204 if (this.config.visitor && method !== "GET")
205 throw new ApiError(`${path}: a folder that reads signed out sends only reads`);
init0Start the project206 const sent = body === undefined ? undefined : JSON.stringify(body);
codex-capacity-chair162Add reviewed disk-first history and indexed graph storage for core issue 16; retain runtime activation gateCompare207 const requestId = method === "POST" ? randomUUID() : undefined;
pinch26Publish and log fixes, and a flaky test removed. - A publish or a land now waits up to 150 s for the server's answer, not 30 s. The server may work on one request for up to 2 minutes, so a slow merge was reported as failed and then landed. - abso log reads any length of history. The server sends at most 200 versions a page, and the client now follows its pages: -n 2000 gives 2000, and --since or a folder reads up to 1000. abso log --before <version> starts below that version. The end of the list names the --before for the next older ones, and a filtered read says when it stopped short. - The test 'sends one run, and takes each command as one quoted word' is removed: it failed on Windows about half the time. The stand-in server the client tests use no longer closes idle kept-alive connections, which other tests also tripped on under load (ECONNRESET). Check: 722 pass, 0 fail.Compare208 const timeoutMs = Math.max(atLeastMs, timeoutFor(this.timeoutMs, sent));
init0Start the project209 // A connection that never opened is tried once more, IPv4 first (#37, GAME - UI/UX: one IPv6
210 // address timed out, and the same command went through seconds later). Nothing went out, so
211 // a POST is as safe to send again as a GET.
212 for (let attempt = 0; res === undefined; attempt++) {
213 try {
pinch88Every request a folder's Api makes goes through one send(): a folder that reads signed out sends only GETs and follows no redirect on every path, box runs and serve included.Compare214 res = await this.send(this.url(path, server), {
init0Start the project215 method,
codex-capacity-chair162Add reviewed disk-first history and indexed graph storage for core issue 16; retain runtime activation gateCompare216 headers: {
217 ...this.headers(sent === undefined ? undefined : "application/json"),
218 ...(requestId ? { "Idempotency-Key": requestId } : {}),
219 },
init0Start the project220 ...(sent === undefined ? {} : { body: sent }),
221 signal: AbortSignal.timeout(timeoutMs),
222 });
223 } catch (err) {
224 const e = err as Error;
225 const why =
226 e.name === "TimeoutError"
227 ? `no answer within ${timeoutMs} ms`
228 : ((e.cause as Error | undefined)?.message ?? e.message);
229 if (!neverSent(err)) throw new ApiError(`could not reach ${server}: ${why}`);
230 if (attempt >= 1) {
231 throw new ApiError(
232 `could not reach ${server}: ${why}. Tried twice, the second time IPv4 first; the connection never opened, so nothing reached the server`,
233 undefined,
234 true,
235 );
236 }
237 setDefaultResultOrder("ipv4first");
238 await new Promise((ok) => setTimeout(ok, 500));
239 }
240 }
codex-prose-authorship-1108Implement bounded sequential client recording for #606Compare241 let text: string;
242 try {
243 text = await res.text();
244 } catch (err) {
245 const reason = err instanceof Error ? err.message : String(err);
246 throw new ApiError(`${method} ${path} response body ended unexpectedly: ${reason}`, res.status);
247 }
init0Start the project248 // 409 is a refusal that says what to do (a drop took out lines your work builds on): print it as it is.
249 if (!res.ok)
250 throw new ApiError(
251 res.status === 409
252 ? `refused: ${errorSentence(text)}`
253 : `${method} ${path} answered ${res.status}: ${errorSentence(text)}`,
254 res.status,
255 );
256 try {
257 return JSON.parse(text) as T;
258 } catch {
259 throw new ApiError(
260 `${method} ${path} answered with something that isn't JSON: ${text.slice(0, 300)}`,
261 res.status,
262 );
263 }
264 }
266 init(
267 files: Record<string, string>,
268 modes: Modes = {},
269 blobs: Readonly<Record<string, string>> = {},
270 ): Promise<{ version: number; skipped?: readonly string[] }> {
271 return this.json("POST", "/init", {
272 files,
273 ...(Object.keys(modes).length > 0 ? { modes } : {}),
274 ...(Object.keys(blobs).length > 0 ? { blobs } : {}),
275 });
276 }
278 edit(body: EditBody): Promise<EditAnswer> {
279 return this.json("POST", this.agentPath("edit"), body);
280 }
282 record(
283 files: Record<string, string | null>,
284 extra: { session?: string; subagent?: string } = {},
285 modes: Modes = {},
286 blobs: Readonly<Record<string, string>> = {},
287 ): Promise<RecordAnswer> {
288 return this.json("POST", this.agentPath("record"), {
289 files,
290 ...(Object.keys(modes).length > 0 ? { modes } : {}),
291 ...(Object.keys(blobs).length > 0 ? { blobs } : {}),
292 ...extra,
293 });
294 }
296 /** Move a file in the draft (#49): its lines keep their ids. The way to change a file's case. */
297 move(from: string, to: string): Promise<{ ok: boolean; from: string; to: string; news?: News }> {
298 return this.json("POST", this.agentPath("move"), { from, to });
299 }
301 /** Upload a binary file's bytes under their sha256 (the server checks the hash). */
302 async putBlob(sha: string, bytes: Uint8Array): Promise<void> {
303 await this.bytes("PUT", `/blobs/${sha}`, bytes);
304 }
306 /** A preview of one version of shared at a stable URL (abso serve, #37); a build answers 422 with its output. */
307 async serve(version?: number, cmd?: string, out?: string): Promise<ServeAnswer> {
308 const q = new URLSearchParams({
309 ...(version !== undefined ? { version: String(version) } : {}),
310 ...(cmd ? { cmd } : {}),
311 ...(out ? { out } : {}),
312 });
313 let res: Response;
314 try {
pinch88Every request a folder's Api makes goes through one send(): a folder that reads signed out sends only GETs and follows no redirect on every path, box runs and serve included.Compare315 res = await this.send(`${this.url("/serve")}?${q}`, {
init0Start the project316 method: "POST",
317 headers: this.headers(),
318 signal: AbortSignal.timeout(20 * 60_000),
319 });
320 } catch (err) {
321 const e = err as Error;
322 throw new ApiError(
323 `could not reach ${this.config.server}: ${(e.cause as Error | undefined)?.message ?? e.message}`,
324 );
325 }
326 const text = await res.text();
327 if (!res.ok && res.status !== 422)
328 throw new ApiError(`serve answered ${res.status}: ${errorSentence(text)}`, res.status);
329 return JSON.parse(text) as ServeAnswer;
330 }
332 /** Runs a setup command on the folder in a fresh box and keeps the box as what it starts from (abso prep, #37). */
333 async prep(command: string, tarGz: Uint8Array<ArrayBuffer>): Promise<PrepAnswer> {
334 let res: Response;
335 try {
pinch88Every request a folder's Api makes goes through one send(): a folder that reads signed out sends only GETs and follows no redirect on every path, box runs and serve included.Compare336 res = await this.send(
337 `${this.url(this.agentPath("prep"))}?cmd=${encodeURIComponent(command)}${boxQuery(this.box)}`,
338 {
339 method: "POST",
340 headers: this.headers("application/gzip"),
341 body: tarGz,
342 // A setup command can take minutes (npm ci, a browser download).
343 signal: AbortSignal.timeout(30 * 60_000),
344 },
345 );
init0Start the project346 } catch (err) {
347 const e = err as Error;
348 throw new ApiError(
349 `could not reach ${this.config.server}: ${(e.cause as Error | undefined)?.message ?? e.message}`,
350 );
351 }
352 const text = await res.text();
353 if (!res.ok) throw new ApiError(`prep answered ${res.status}: ${errorSentence(text)}`, res.status);
354 return JSON.parse(text) as PrepAnswer;
355 }
357 /** Forgets the box's prep: it starts from the plain image again. Answers whether it had one. */
358 async unprep(): Promise<boolean> {
359 let res: Response;
360 try {
pinch88Every request a folder's Api makes goes through one send(): a folder that reads signed out sends only GETs and follows no redirect on every path, box runs and serve included.Compare361 res = await this.send(
init0Start the project362 `${this.url(this.agentPath("prep"))}${this.box ? `?box=${encodeURIComponent(this.box)}` : ""}`,
363 { method: "DELETE", headers: this.headers(), signal: AbortSignal.timeout(this.timeoutMs) },
364 );
365 } catch (err) {
366 const e = err as Error;
367 throw new ApiError(
368 `could not reach ${this.config.server}: ${(e.cause as Error | undefined)?.message ?? e.message}`,
369 );
370 }
371 const text = await res.text();
372 if (!res.ok) throw new ApiError(`prep answered ${res.status}: ${errorSentence(text)}`, res.status);
373 return (JSON.parse(text) as { forgot: boolean }).forgot;
374 }
376 /** A binary file's bytes by their sha256. */
377 /** A tar.gz of the files under the box's /w that match a glob (bash globstar); null when none match or the box has stopped. */
378 async boxFiles(glob: string): Promise<Uint8Array | null> {
379 try {
380 return await this.bytes(
381 "GET",
382 `${this.agentPath("box-files")}?${new URLSearchParams({ glob, ...(this.box ? { box: this.box } : {}) })}`,
383 );
384 } catch (err) {
385 if (err instanceof ApiError && err.status === 404) return null;
386 throw err;
387 }
388 }
390 getBlob(sha: string): Promise<Uint8Array> {
391 return this.bytes("GET", `/blobs/${sha}`);
392 }
394 async bytes(method: "GET" | "PUT", path: string, body?: Uint8Array): Promise<Uint8Array> {
395 let res: Response;
396 try {
pinch88Every request a folder's Api makes goes through one send(): a folder that reads signed out sends only GETs and follows no redirect on every path, box runs and serve included.Compare397 res = await this.send(this.url(path), {
init0Start the project398 method,
399 headers: this.headers(body === undefined ? undefined : "application/octet-stream"),
400 ...(body === undefined ? {} : { body: body as Uint8Array<ArrayBuffer> }),
401 signal: AbortSignal.timeout(Math.max(this.timeoutMs, 120_000)),
402 });
403 } catch (err) {
404 const e = err as Error;
405 throw new ApiError(
406 `could not reach ${this.config.server}: ${(e.cause as Error | undefined)?.message ?? e.message}`,
407 );
408 }
409 const data = new Uint8Array(await res.arrayBuffer());
410 if (!res.ok)
411 throw new ApiError(
412 `${method} ${path} answered ${res.status}: ${errorSentence(new TextDecoder().decode(data))}`,
413 res.status,
414 );
415 return data;
416 }
418 /** Make this agent a reader, or not (#37): a reader's edits, records and publishes are refused. */
419 reader(on: boolean): Promise<{ agent: string; reader: boolean }> {
420 return this.json("POST", this.agentPath("reader"), { reader: on });
421 }
423 publish(message: string, asIs = false): Promise<PublishAnswer> {
pinch26Publish and log fixes, and a flaky test removed. - A publish or a land now waits up to 150 s for the server's answer, not 30 s. The server may work on one request for up to 2 minutes, so a slow merge was reported as failed and then landed. - abso log reads any length of history. The server sends at most 200 versions a page, and the client now follows its pages: -n 2000 gives 2000, and --since or a folder reads up to 1000. abso log --before <version> starts below that version. The end of the list names the --before for the next older ones, and a filtered read says when it stopped short. - The test 'sends one run, and takes each command as one quoted word' is removed: it failed on Windows about half the time. The stand-in server the client tests use no longer closes idle kept-alive connections, which other tests also tripped on under load (ECONNRESET). Check: 722 pass, 0 fail.Compare424 return this.json(
425 "POST",
426 this.agentPath("publish"),
427 { message, ...(asIs ? { asIs: true } : {}) },
428 undefined,
429 PUBLISH_TIMEOUT_MS,
430 );
init0Start the project431 }
433 /** One change (#44). */
434 change(id: number): Promise<ChangeAnswer> {
435 return this.json("GET", `/change/${id}`);
436 }
438 /** The changes with anything new at or after log position `since`, newest first (#44). */
439 /** Changes active since a log position, newest first; `older` is set when more come before the page (ask again with `before`). */
440 changes(
441 since: number,
442 limit = 50,
443 before?: number,
444 ): Promise<{ since: number; next: number; changes: readonly ChangeAnswer[]; older?: number }> {
445 return this.json("GET", `/changes?${query({ since, limit, before })}`);
446 }
448 /** A call to the Issues Worker (#54), with the same token. */
449 #issues<T>(method: "GET" | "POST", path: string, body?: unknown): Promise<T> {
450 if (this.issuesServer === undefined)
review27Client: ABSO_ environment names (AVCS_ still read), .absoignore (.avcsignore still read), .abso-export.json, shot files; READMEs say abso (abso 224)Compare451 throw new ApiError(`${this.config.server} has no Issues Worker beside it; ABSO_ISSUES_SERVER names one`);
init0Start the project452 return this.json(method, path, body, this.issuesServer);
453 }
pinch89abso reply N, abso ask N and abso asked name a server without ask threads instead of answering its bare 404.Compare455 /** An ask-thread call, with a server from before ask threads named as that rather than a bare 404. */
456 async #threads<T>(call: Promise<T>): Promise<T> {
457 try {
458 return await call;
459 } catch (err) {
460 if (err instanceof ApiError && err.status === 404 && /no such issues route/.test(err.message))
461 throw new ApiError(`${this.config.server} doesn't have ask threads yet`, 404);
462 throw err;
463 }
464 }
init0Start the project466 /** Issues, most recently updated first. */
467 issues(
468 q: { status?: string; agent?: string; parent?: number; open?: boolean; labels?: readonly string[] } = {},
469 ): Promise<{ issues: readonly IssueRow[] }> {
470 return this.#issues(
471 "GET",
472 `/issues?${query({ status: q.status, agent: q.agent, parent: q.parent, open: q.open ? 1 : undefined, label: q.labels && q.labels.length > 0 ? q.labels.join(",") : undefined })}`,
473 );
devops20Add abso search: find a project's issues by words or meaning `abso search "<words>" [--limit <N>]` lists the project's issues that match, best first, and is served as an MCP tool as well. - Each hit shows the issue, then where it matched: the title, the description, a comment, or "by meaning". - "#N" or "N" puts issue N first. - Where the server also searches by meaning, an issue worded unlike the search still turns up; the hit says so.Compare474 }
476 /**
477 * The project's issues matching q, best first: by its words and, where
478 * the server has it on, by what it means.
479 */
480 issueSearch(q: string, limit?: number): Promise<{ hits: readonly IssueSearchHit[] }> {
481 return this.#issues("GET", `/search?${query({ q, limit })}`);
init0Start the project482 }
484 /** Every label in use, with how many issues have it and how many of those are open. */
485 issueLabels(): Promise<{ labels: readonly { label: string; open: number; total: number }[] }> {
486 return this.#issues("GET", "/labels");
487 }
489 issue(id: number): Promise<IssuePage> {
490 return this.#issues("GET", `/issue/${id}`);
491 }
pinch72Asks become threads: abso reply <ask> "..." adds to an ask from either side, open or answered, and --question hands the turn to the asker until they reply. abso ask <N> shows one ask with its whole thread and whose turn it is; abso waiting --asked lists the asks you sent. An ack's note is the thread's first reply. reply is an MCP tool too. Needs an Issues server with the reply, ask and asked routes.Compare493 /** The asks this agent sent: the open ones, then the latest answered, each with its thread. */
494 asked(): Promise<{ asks: readonly (Ask & { title: string | null })[] }> {
pinch89abso reply N, abso ask N and abso asked name a server without ask threads instead of answering its bare 404.Compare495 return this.#threads(this.#issues("GET", this.agentPath("asked")));
pinch72Asks become threads: abso reply <ask> "..." adds to an ask from either side, open or answered, and --question hands the turn to the asker until they reply. abso ask <N> shows one ask with its whole thread and whose turn it is; abso waiting --asked lists the asks you sent. An ack's note is the thread's first reply. reply is an MCP tool too. Needs an Issues server with the reply, ask and asked routes.Compare496 }
498 /** One ask, open or closed, with its thread and who it waits on. */
499 askThread(id: number): Promise<{ ask: Ask & { title: string | null } }> {
pinch89abso reply N, abso ask N and abso asked name a server without ask threads instead of answering its bare 404.Compare500 return this.#threads(this.#issues("GET", `/ask/${id}`));
pinch72Asks become threads: abso reply <ask> "..." adds to an ask from either side, open or answered, and --question hands the turn to the asker until they reply. abso ask <N> shows one ask with its whole thread and whose turn it is; abso waiting --asked lists the asks you sent. An ack's note is the thread's first reply. reply is an MCP tool too. Needs an Issues server with the reply, ask and asked routes.Compare501 }
init0Start the project503 /** Open asks of someone (an agent, or person:<id>), soonest due first; every open ask without `of`. */
504 waiting(of?: string): Promise<{ asks: readonly (Ask & { title: string | null })[] }> {
505 return this.#issues("GET", `/waiting?${query({ of })}`);
506 }
508 /** This agent's open asks; the Worker marks each it lists for the first time as seen (abso issue 124). */
509 async waitingMine(): Promise<{ asks: readonly (Ask & { title: string | null })[] }> {
510 try {
511 return await this.#issues("GET", this.agentPath("waiting"));
512 } catch (err) {
513 // An Issues Worker from before 124 has no /a/:agent/ reads.
514 if (err instanceof ApiError && err.status === 404) return this.waiting(this.config.agent);
515 throw err;
516 }
517 }
pinch5abso issue new and abso issue N --comment take --attach <file,file> (abso issue 171). Each file goes up to the Issues Worker first (POST /p/:project/a/:agent/attachments, the bytes as the body and the name URI-encoded in X-Avcs-Name), and the write carries the ids the uploads answered. Nothing is sent if a file is missing or over 10 MB. --attach anywhere else is refused. The issue's page lists each attachment under the issue or comment carrying it: id, name, size and its link. The wire types gain Attachment and attachments?. MCP's issue tool takes attach too, since its parameters come from the flags. The server side is abso 621 (off until Cloud binds the bucket). Tests: client/test/attach.test.ts, against a stand-in Issues server. Checked: biome ci, npm run check (698 pass).Compare519 issueOpen(body: DraftBody & { title: string; attachments?: string[] }): Promise<{ id: number; news?: IssueNews }> {
init0Start the project520 return this.#issues("POST", this.agentPath("issue"), body);
521 }
pinch5abso issue new and abso issue N --comment take --attach <file,file> (abso issue 171). Each file goes up to the Issues Worker first (POST /p/:project/a/:agent/attachments, the bytes as the body and the name URI-encoded in X-Avcs-Name), and the write carries the ids the uploads answered. Nothing is sent if a file is missing or over 10 MB. --attach anywhere else is refused. The issue's page lists each attachment under the issue or comment carrying it: id, name, size and its link. The wire types gain Attachment and attachments?. MCP's issue tool takes attach too, since its parameters come from the flags. The server side is abso 621 (off until Cloud binds the bucket). Tests: client/test/attach.test.ts, against a stand-in Issues server. Checked: biome ci, npm run check (698 pass).Compare523 /** Uploads an image to the Issues Worker (abso issue 171): it checks the type by the bytes, strips metadata and answers its id. */
524 async attachmentUpload(bytes: Uint8Array, name: string): Promise<Attachment> {
525 if (this.issuesServer === undefined)
review27Client: ABSO_ environment names (AVCS_ still read), .absoignore (.avcsignore still read), .abso-export.json, shot files; READMEs say abso (abso 224)Compare526 throw new ApiError(`${this.config.server} has no Issues Worker beside it; ABSO_ISSUES_SERVER names one`);
pinch5abso issue new and abso issue N --comment take --attach <file,file> (abso issue 171). Each file goes up to the Issues Worker first (POST /p/:project/a/:agent/attachments, the bytes as the body and the name URI-encoded in X-Avcs-Name), and the write carries the ids the uploads answered. Nothing is sent if a file is missing or over 10 MB. --attach anywhere else is refused. The issue's page lists each attachment under the issue or comment carrying it: id, name, size and its link. The wire types gain Attachment and attachments?. MCP's issue tool takes attach too, since its parameters come from the flags. The server side is abso 621 (off until Cloud binds the bucket). Tests: client/test/attach.test.ts, against a stand-in Issues server. Checked: biome ci, npm run check (698 pass).Compare527 const path = this.agentPath("attachments");
528 let res: Response;
529 try {
pinch88Every request a folder's Api makes goes through one send(): a folder that reads signed out sends only GETs and follows no redirect on every path, box runs and serve included.Compare530 res = await this.send(this.url(path, this.issuesServer), {
pinch5abso issue new and abso issue N --comment take --attach <file,file> (abso issue 171). Each file goes up to the Issues Worker first (POST /p/:project/a/:agent/attachments, the bytes as the body and the name URI-encoded in X-Avcs-Name), and the write carries the ids the uploads answered. Nothing is sent if a file is missing or over 10 MB. --attach anywhere else is refused. The issue's page lists each attachment under the issue or comment carrying it: id, name, size and its link. The wire types gain Attachment and attachments?. MCP's issue tool takes attach too, since its parameters come from the flags. The server side is abso 621 (off until Cloud binds the bucket). Tests: client/test/attach.test.ts, against a stand-in Issues server. Checked: biome ci, npm run check (698 pass).Compare531 method: "POST",
pinch54The client and the edit mods send and read X-Abso-* headers only (Client, Name, Run-Key, Kind, Admin; Run, Box, Prep from answers). Servers have read X-Abso-* beside the old names for a while and answer under both, so this works with any current server.Compare532 headers: { ...this.headers("application/octet-stream"), "x-abso-name": encodeURIComponent(name) },
pinch5abso issue new and abso issue N --comment take --attach <file,file> (abso issue 171). Each file goes up to the Issues Worker first (POST /p/:project/a/:agent/attachments, the bytes as the body and the name URI-encoded in X-Avcs-Name), and the write carries the ids the uploads answered. Nothing is sent if a file is missing or over 10 MB. --attach anywhere else is refused. The issue's page lists each attachment under the issue or comment carrying it: id, name, size and its link. The wire types gain Attachment and attachments?. MCP's issue tool takes attach too, since its parameters come from the flags. The server side is abso 621 (off until Cloud binds the bucket). Tests: client/test/attach.test.ts, against a stand-in Issues server. Checked: biome ci, npm run check (698 pass).Compare533 body: bytes as Uint8Array<ArrayBuffer>,
534 signal: AbortSignal.timeout(Math.max(this.timeoutMs, 120_000)),
535 });
536 } catch (err) {
537 const e = err as Error;
538 throw new ApiError(
539 `could not reach ${this.issuesServer}: ${(e.cause as Error | undefined)?.message ?? e.message}`,
540 );
541 }
542 const text = await res.text();
pinch15--attach says plainly when the Issues server doesn't take attachments yet A server from before attachments has no upload route. It answered 400 'the body is JSON', or 404, and the client printed that as it came, which told nobody what had happened. Now the client says the server doesn't take attachments yet, that the file wasn't sent and nothing was written, and to leave --attach off or link the image instead. A server that has the route but nowhere to keep files (501) gets the same message. A test checks the message and that no issue is opened.Compare543 // A server from before attachments has no upload route: it answers 404, or 400 because the body isn't JSON;
544 // one with the route but nowhere to keep files answers 501. Say so plainly, and that nothing was sent.
545 if (res.status === 404 || res.status === 501 || (res.status === 400 && /the body is JSON/.test(text)))
546 throw new ApiError(
547 `${this.issuesServer} doesn't take attachments yet, so ${name} wasn't sent and nothing was written. Leave --attach off, or link the image instead.`,
548 res.status,
549 );
pinch5abso issue new and abso issue N --comment take --attach <file,file> (abso issue 171). Each file goes up to the Issues Worker first (POST /p/:project/a/:agent/attachments, the bytes as the body and the name URI-encoded in X-Avcs-Name), and the write carries the ids the uploads answered. Nothing is sent if a file is missing or over 10 MB. --attach anywhere else is refused. The issue's page lists each attachment under the issue or comment carrying it: id, name, size and its link. The wire types gain Attachment and attachments?. MCP's issue tool takes attach too, since its parameters come from the flags. The server side is abso 621 (off until Cloud binds the bucket). Tests: client/test/attach.test.ts, against a stand-in Issues server. Checked: biome ci, npm run check (698 pass).Compare550 if (!res.ok) throw new ApiError(`uploading ${name} answered ${res.status}: ${errorSentence(text)}`, res.status);
551 return JSON.parse(text) as Attachment;
pinch23abso issue <N> --copy-to <project>: copy an issue into another project, with its comments, answered asks and labels, each keeping its author and time. The Issues server reads the source issue itself; the client sends only which issue, and any cleaned texts. - --dry-run shows what the copy would make (title, how many comments and asks, which were edited, labels) and what's left behind. It writes nothing. - --clean <file> gives cleaned texts by source id, as JSON: {title, description, comments: [{id, text}], asks: [{id, question, answer}]}. A comment left out of a given list isn't copied. - --copy-to goes alone, so a copy is never half an edit. Copying into the project the issue is already in is refused before any call. - When a live server refuses the copy (copying out of a project there takes an owner of it), the message says --dry-run still works. - The MCP issue tool's clean input is a file too, so it's confined to the server's start folder like attach. Tests: client/test/issues.test.ts, against a stand-in Issues server. The run --parallel test that sometimes times out under a full run passed when rerun.Compare552 }
554 /**
555 * Copies issue `body.issue` of this project into project `to`, keeping
556 * authors and times: the Issues server reads the source itself, and only
557 * texts may be given cleaned. A dry run answers the plan and writes nothing.
558 */
559 issueCopy(to: string, body: CopyBody & { dryRun?: boolean }): Promise<CopyAnswer> {
560 const there = new Api({ ...this.config, project: to }, this.timeoutMs);
561 there.issuesServer = this.issuesServer;
562 return there.#issues("POST", there.agentPath("copy"), body);
pinch5abso issue new and abso issue N --comment take --attach <file,file> (abso issue 171). Each file goes up to the Issues Worker first (POST /p/:project/a/:agent/attachments, the bytes as the body and the name URI-encoded in X-Avcs-Name), and the write carries the ids the uploads answered. Nothing is sent if a file is missing or over 10 MB. --attach anywhere else is refused. The issue's page lists each attachment under the issue or comment carrying it: id, name, size and its link. The wire types gain Attachment and attachments?. MCP's issue tool takes attach too, since its parameters come from the flags. The server side is abso 621 (off until Cloud binds the bucket). Tests: client/test/attach.test.ts, against a stand-in Issues server. Checked: biome ci, npm run check (698 pass).Compare563 }
565 /** Where an attachment is served. */
566 attachmentUrl(id: string): string {
567 return this.url(`/attachments/${id}`, this.issuesServer);
568 }
pinch29Client: abso issue N --save-attachments <dir> saves each attachment on an issue and its comments once (an SVG's own file beside its drawing), outside the abso folder unless the place is ignored; MCP confines the folder like attach. abso export now stamps its folder with .abso-export, one line of JSON in a file with no extension, so the exported project's own formatter and linter pass it by; a folder stamped .abso-export.json or .avcs-export.json still counts as an export.Compare569
570 /** An attachment's bytes, or with `source` the svg it was drawn from; refused past `max` bytes. */
571 async attachmentBytes(id: string, source: boolean, max: number): Promise<Uint8Array> {
572 if (this.issuesServer === undefined)
573 throw new ApiError(`${this.config.server} has no Issues Worker beside it; ABSO_ISSUES_SERVER names one`);
574 const url = `${this.attachmentUrl(id)}${source ? "/source" : ""}`;
575 let res: Response;
576 try {
pinch88Every request a folder's Api makes goes through one send(): a folder that reads signed out sends only GETs and follows no redirect on every path, box runs and serve included.Compare577 res = await this.send(url, {
pinch29Client: abso issue N --save-attachments <dir> saves each attachment on an issue and its comments once (an SVG's own file beside its drawing), outside the abso folder unless the place is ignored; MCP confines the folder like attach. abso export now stamps its folder with .abso-export, one line of JSON in a file with no extension, so the exported project's own formatter and linter pass it by; a folder stamped .abso-export.json or .avcs-export.json still counts as an export.Compare578 headers: this.headers(),
579 signal: AbortSignal.timeout(Math.max(this.timeoutMs, 120_000)),
580 });
581 } catch (err) {
582 const e = err as Error;
583 throw new ApiError(
584 `could not reach ${this.issuesServer}: ${(e.cause as Error | undefined)?.message ?? e.message}`,
585 );
586 }
587 if (!res.ok) throw new ApiError(`${url} answered ${res.status}: ${errorSentence(await res.text())}`, res.status);
588 const bytes = new Uint8Array(await res.arrayBuffer());
589 if (bytes.length > max) throw new ApiError(`${url} sent ${bytes.length} bytes, more than an attachment may be`);
590 return bytes;
591 }
pinch5abso issue new and abso issue N --comment take --attach <file,file> (abso issue 171). Each file goes up to the Issues Worker first (POST /p/:project/a/:agent/attachments, the bytes as the body and the name URI-encoded in X-Avcs-Name), and the write carries the ids the uploads answered. Nothing is sent if a file is missing or over 10 MB. --attach anywhere else is refused. The issue's page lists each attachment under the issue or comment carrying it: id, name, size and its link. The wire types gain Attachment and attachments?. MCP's issue tool takes attach too, since its parameters come from the flags. The server side is abso 621 (off until Cloud binds the bucket). Tests: client/test/attach.test.ts, against a stand-in Issues server. Checked: biome ci, npm run check (698 pass).Compare592
init0Start the project593 /** An edit (abso issue 3): it tells the issue's watchers, and `also`, unless `notify` is false. null clears a parent or Agent. */
594 issueEdit(
595 id: number,
596 body: {
597 title?: string;
598 description?: string;
599 parent?: number | null;
600 agent?: string | null;
601 blockedBy?: number[];
602 notify?: boolean;
603 also?: string[];
604 addLabels?: string[];
605 removeLabels?: string[];
606 },
607 ): Promise<{ edit: number; notified: readonly string[]; news?: IssueNews }> {
608 return this.#issues("POST", this.agentPath(`issue/${id}/edit`), body);
609 }
pinch5abso issue new and abso issue N --comment take --attach <file,file> (abso issue 171). Each file goes up to the Issues Worker first (POST /p/:project/a/:agent/attachments, the bytes as the body and the name URI-encoded in X-Avcs-Name), and the write carries the ids the uploads answered. Nothing is sent if a file is missing or over 10 MB. --attach anywhere else is refused. The issue's page lists each attachment under the issue or comment carrying it: id, name, size and its link. The wire types gain Attachment and attachments?. MCP's issue tool takes attach too, since its parameters come from the flags. The server side is abso 621 (off until Cloud binds the bucket). Tests: client/test/attach.test.ts, against a stand-in Issues server. Checked: biome ci, npm run check (698 pass).Compare611 issueComment(
612 id: number,
613 text: string,
614 objection = false,
615 attachments: readonly string[] = [],
616 ): Promise<{ id: number; news?: IssueNews }> {
617 return this.#issues("POST", this.agentPath(`issue/${id}/comment`), {
618 text,
619 ...(objection ? { objection } : {}),
620 ...(attachments.length > 0 ? { attachments } : {}),
621 });
init0Start the project622 }
624 issueDrop(id: number): Promise<{ news?: IssueNews }> {
625 return this.#issues("POST", this.agentPath(`issue/${id}/drop`), {});
626 }
628 /** Opens a dropped issue again (abso issue 104). */
629 issueReopen(id: number): Promise<{ news?: IssueNews }> {
630 return this.#issues("POST", this.agentPath(`issue/${id}/reopen`), {});
631 }
633 /** Marks an issue done by hand (abso issue 38). `version` is the publish that did it, when there is one. */
634 issueDone(id: number, version: number | null): Promise<{ news?: IssueNews }> {
635 return this.#issues("POST", this.agentPath(`issue/${id}/done`), { ...(version !== null ? { version } : {}) });
636 }
638 /** This agent's drafts (abso issue 3): its own, with no number and no news, newest first. */
639 drafts(): Promise<{ drafts: readonly Draft[] }> {
640 return this.#issues("GET", this.agentPath("drafts"));
641 }
643 /** Saves a draft, new or (with id) over one of this agent's: the body replaces the draft's. */
644 saveDraft(body: DraftBody & { id?: number }): Promise<{ id: number }> {
645 return this.#issues("POST", this.agentPath("draft"), body);
646 }
648 /** Opens a draft as an issue, `body`'s fields over the draft's, and deletes the draft. */
649 openDraft(id: number, body: DraftBody = {}): Promise<{ id: number; news?: IssueNews }> {
650 return this.#issues("POST", this.agentPath(`draft/${id}/open`), body);
651 }
653 deleteDraft(id: number): Promise<{ ok: boolean }> {
654 return this.#issues("POST", this.agentPath(`draft/${id}/delete`), {});
655 }
657 ask(body: {
658 issue?: number;
659 of: string;
660 question: string;
661 review?: boolean;
662 kind?: "question" | "task";
663 due?: string;
664 blocks?: number[];
665 options?: string[];
pinch35Client: files on asks and answers. abso ask and abso answer take --attach (uploaded first, as on issues; not with --withdraw); an ask lists its question's files under it and its answer's under the answer; abso issue N --save-attachments takes them too. An Issues server from before asks carried files keeps the words and drops the files: abso says so (notKept in --json) instead of losing them quietly. Wire: Ask.attachments and answer.attachments, optional. Client tests 286/286, tsc and biome clean.Compare666 attachments?: string[];
667 }): Promise<{ id: number; news?: IssueNews; attachments?: string[] }> {
init0Start the project668 return this.#issues("POST", this.agentPath("ask"), body);
669 }
671 answer(
672 id: number,
pinch35Client: files on asks and answers. abso ask and abso answer take --attach (uploaded first, as on issues; not with --withdraw); an ask lists its question's files under it and its answer's under the answer; abso issue N --save-attachments takes them too. An Issues server from before asks carried files keeps the words and drops the files: abso says so (notKept in --json) instead of losing them quietly. Wire: Ask.attachments and answer.attachments, optional. Client tests 286/286, tsc and biome clean.Compare673 body: { words?: string; option?: number | string; note?: string; done?: boolean; attachments?: string[] },
init0Start the project674 ): Promise<{ ask: Ask; news?: IssueNews }> {
675 return this.#issues("POST", this.agentPath(`answer/${id}`), body);
676 }
infra-split14An asker can take back an ask: abso ask --withdraw <ask> [--note "why"] An ask that later decisions have overtaken used to sit in the asked person's waiting list for good. Only they could answer it, and "none of these" wasn't an option. Now the one who asked can withdraw it. - `abso ask --withdraw <ask> [--note "why"]` sends one call to the server's withdraw route. It's refused before any call when mixed with a question or the other ask flags. `--note-file` reads the note from a file or stdin, like every text flag. - A withdrawn ask closes the way an answered one does: it leaves the waiting list, and it stops holding its issue at Blocked. The ask keeps its question. The asker's note is kept as why, and the one asked hears it. - Ask gains `outcome?: "withdrawn"`. Older servers leave it out. The asks list and an issue's page show "withdrawn by <asker>" and the note, instead of "answered by". - The server side of the route comes with the hosted Issues service. Until it's there, the call answers with that server's error. Tests: the new usage mistakes, and the single POST to the asker's own route. Checked: npx biome ci . and npm run check exit 0 (704 pass, 1 skipped).Compare677
pinch53abso ack <ask> ["note"]: the one asked says they have an ask and will answer later. The ask stays open and keeps blocking; abso issue shows it as acknowledged with the note, and the asker hears it. The Ask wire type gains ack, the API client gains ack(), and the skill mentions the command.Compare678 /** Acknowledges an ask of this agent without answering it: the asker hears it, and the ask stays open. */
679 ack(id: number, body: { note?: string }): Promise<{ ask: Ask; news?: IssueNews }> {
680 return this.#issues("POST", this.agentPath(`ack/${id}`), body);
pinch72Asks become threads: abso reply <ask> "..." adds to an ask from either side, open or answered, and --question hands the turn to the asker until they reply. abso ask <N> shows one ask with its whole thread and whose turn it is; abso waiting --asked lists the asks you sent. An ack's note is the thread's first reply. reply is an MCP tool too. Needs an Issues server with the reply, ask and asked routes.Compare681 }
683 /** Adds to an ask's thread, as its asker or the one asked; the other side hears it, and the ask stays as it is. */
684 reply(id: number, body: { text: string; question?: boolean }): Promise<{ ask: Ask; news?: IssueNews }> {
pinch89abso reply N, abso ask N and abso asked name a server without ask threads instead of answering its bare 404.Compare685 return this.#threads(this.#issues("POST", this.agentPath(`reply/${id}`), body));
pinch53abso ack <ask> ["note"]: the one asked says they have an ask and will answer later. The ask stays open and keeps blocking; abso issue shows it as acknowledged with the note, and the asker hears it. The Ask wire type gains ack, the API client gains ack(), and the skill mentions the command.Compare686 }
infra-split14An asker can take back an ask: abso ask --withdraw <ask> [--note "why"] An ask that later decisions have overtaken used to sit in the asked person's waiting list for good. Only they could answer it, and "none of these" wasn't an option. Now the one who asked can withdraw it. - `abso ask --withdraw <ask> [--note "why"]` sends one call to the server's withdraw route. It's refused before any call when mixed with a question or the other ask flags. `--note-file` reads the note from a file or stdin, like every text flag. - A withdrawn ask closes the way an answered one does: it leaves the waiting list, and it stops holding its issue at Blocked. The ask keeps its question. The asker's note is kept as why, and the one asked hears it. - Ask gains `outcome?: "withdrawn"`. Older servers leave it out. The asks list and an issue's page show "withdrawn by <asker>" and the note, instead of "answered by". - The server side of the route comes with the hosted Issues service. Until it's there, the call answers with that server's error. Tests: the new usage mistakes, and the single POST to the asker's own route. Checked: npx biome ci . and npm run check exit 0 (704 pass, 1 skipped).Compare688 /** Takes back an ask this agent made, with a note on why; the one asked hears it. */
689 withdraw(id: number, body: { note?: string }): Promise<{ ask: Ask; news?: IssueNews }> {
690 return this.#issues("POST", this.agentPath(`withdraw/${id}`), body);
691 }
init0Start the project692
693 /** Notes on lines (#44), by file or change; open ones only with `open`. */
694 notes(q: { file?: string; change?: number; open?: boolean } = {}): Promise<{ notes: readonly NoteAnswer[] }> {
695 return this.json("GET", `/notes?${query({ file: q.file, change: q.change, open: q.open ? 1 : undefined })}`);
696 }
698 note(body: NoteBody): Promise<{ id: number; change: number | null; lines: readonly [number, number] }> {
699 return this.json("POST", this.agentPath("note"), body);
700 }
702 noteClose(id: number, how: "resolved" | "withdrawn"): Promise<unknown> {
703 return this.json("POST", this.agentPath("note-close"), { id, how });
704 }
706 /** The merge queue now (#39). */
707 queueState(): Promise<QueueState> {
708 return this.json("GET", "/queue");
709 }
711 /** The project's visibility (abso issue 152): public or private. */
712 visibility(): Promise<{ project: string; visibility: "public" | "private" }> {
713 return this.json("GET", "/visibility");
714 }
716 /** Switch the project's visibility (abso issue 140): an owner's key, or the shared token on staging. */
717 setVisibility(v: "public" | "private"): Promise<{ project: string; visibility: "public" | "private" }> {
718 return this.json("POST", `/visibility?visibility=${v}`, {});
autosettle220abso autosettle: see or change what the server does with a held push (abso-core 23) abso autosettle says the project's choice: Off, Advise, or Settle at a confidence. It also says when the gate is stopped and who changed it last. abso autosettle off|advise|settle [--at 0.3-0.95] changes it, which takes the owner's key (on staging, the shared token too); without --at the server keeps its own. On a server with no choice per project (the open server), it says the operator's AUTOSETTLE decides. A visitor folder refuses it. Tried on project abso's Worker run locally (read, settle --at 0.7, advise, a bad word, --at 2) and on the open server. Tests: autosettle-command (words), visitor (the allow-list), typecheck clean.Compare719 }
721 /** The project's auto-settle choice (abso-core 23): off, advise or settle, and how sure before abso settles. */
722 autosettle(): Promise<AutosettleAnswer> {
723 return this.json("GET", "/autosettle");
724 }
726 /** Change it (abso-core 23): an owner's key, or the shared token on staging. Without `at`, the server keeps its own. */
727 setAutosettle(mode: AutosettleMode, at?: number): Promise<AutosettleAnswer> {
728 return this.json("POST", `/autosettle?mode=${mode}${at === undefined ? "" : `&at=${at}`}`, {});
init0Start the project729 }
autosettle223abso autosettle history: the held pushes the model advised on, and what was then kept (abso-core 23) abso autosettle history lists a project's held pushes that got advice, newest first. Each collision gets one line: what the model said (a side or leave it to an agent, by a check in code or the model with its confidence), whether abso was told to settle it, and what the agent then kept, automatically or by hand, in which version. abso autosettle history <id> shows one, naming its calls to the model; --json has each exact request and raw answer. It reads the platform's /autosettle/history routes (project abso 1249). Tests: autosettle-command (words, history lines), visitor (the allow-list); typecheck clean.Compare731 /** Auto-settle's history (abso-core 23): held pushes the model advised on, newest first. */
732 autosettleHistory(): Promise<unknown> {
733 return this.json("GET", "/autosettle/history");
734 }
736 /** One held push from the history, with each collision's calls to the model. */
737 autosettleHold(id: number): Promise<unknown> {
738 return this.json("GET", `/autosettle/history/${id}`);
739 }
init0Start the project741 /** Take back this agent's queued publishes (#39); refused while one is being checked. */
742 unqueue(): Promise<{ pulled: readonly number[] }> {
743 return this.json("POST", this.agentPath("unqueue"), {});
744 }
746 /**
747 * Sync; a folder following a label goes to the newest version with that label.
748 * With `full`, the answer holds every file in the agent's view, as a first sync's does,
749 * not only what changed since its last sync (#37: a join for an agent the server knew).
750 */
751 sync(options: { full?: boolean } = {}): Promise<SyncAnswer> {
752 return this.json("POST", this.agentPath("sync"), {
753 ...(this.config.follow ? { label: this.config.follow } : {}),
754 ...(options.full ? { full: true } : {}),
755 });
756 }
758 /** Take published versions back out of shared (with the versions that build on them, when asked). */
759 drop(versions: readonly number[], message: string, withDependents = false): Promise<DropAnswer> {
760 return this.json("POST", this.agentPath("drop"), {
761 versions,
762 message,
763 ...(withDependents ? { withDependents: true } : {}),
764 });
765 }
767 /** Take some versions of a named draft into shared, as one version. */
768 pluck(draft: string, versions: readonly number[], message: string, withDependencies = false): Promise<PluckAnswer> {
769 return this.json("POST", this.agentPath("pluck"), {
770 draft,
771 versions,
772 message,
773 ...(withDependencies ? { withDependencies: true } : {}),
774 });
775 }
777 /** Correct the message of this agent's newest publish in its space. */
778 amend(message: string): Promise<{ version: number; draft: string | null; message: string; was: string }> {
779 return this.json("POST", this.agentPath("amend"), { message });
780 }
782 /** Put a label on a version of shared (the newest by default), or take it off. */
783 label(
784 name: string,
785 version?: number,
786 remove = false,
787 ): Promise<{ name: string; version: number; versions: readonly number[] }> {
788 return this.json("POST", this.agentPath("label"), {
789 name,
790 ...(version === undefined ? {} : { version }),
791 ...(remove ? { remove: true } : {}),
792 });
793 }
795 labels(): Promise<{ labels: Readonly<Record<string, readonly number[]>> }> {
796 return this.json("GET", "/labels");
797 }
799 status(): Promise<StatusAnswer> {
800 return this.json("GET", "/status");
801 }
803 /** The status and the paths in the agent's view, in one trip (abso issue 80). */
804 async statusAndFiles(): Promise<StatusAnswer & { files: FilesAnswer | undefined }> {
805 try {
806 return await this.json("GET", this.agentPath("status"));
807 } catch (err) {
808 // A server from before it has no /a/:agent/status; the listing itself is from #37.
809 if (!(err instanceof ApiError && err.status === 404)) throw err;
810 }
811 const status = await this.status();
812 return { ...status, files: await this.viewFiles().catch(() => undefined) };
813 }
815 /** CI's state (#39), or one version's job. */
816 ci(): Promise<CiStatus>;
817 ci(version: number): Promise<CiJob>;
818 ci(version?: number): Promise<CiStatus | CiJob> {
819 return this.json("GET", version === undefined ? "/ci" : `/ci?${query({ version })}`);
820 }
infra-pipeline85abso pipeline runs: list a project's pipeline runs, show one run's jobs (state, why each stopped, exit, time, an npm or deploy job's phase), and print a job's log with --log <pipeline.job>Compare822 /** The project's pipeline runs, newest first; one run with its jobs; or one job's log (`log` is pipeline.job). */
823 pipelineRuns(run?: number, log?: string): Promise<unknown> {
824 return this.json("GET", run === undefined ? "/pipelines" : `/pipelines?${query({ run, log })}`);
825 }
init0Start the project827 /** Ends every /latest link handed out so far; answers CI's state with the new link. */
828 ciRevoke(): Promise<CiStatus> {
829 return this.json("POST", "/ci/revoke", {});
830 }
832 /** Count versions up to `through` as seen by CI and end any red or bisect, so an import's history isn't checked (#56). */
833 ciSkip(through: number): Promise<unknown> {
834 return this.json("POST", "/ci/skip", { through });
835 }
837 /** Move to a named draft (null: shared). With carry, the current unpublished changes start a new draft. */
838 switchDraft(name: string | null, carry = false): Promise<SwitchAnswer> {
839 return this.json("POST", this.agentPath("draft"), { name, ...(carry ? { carry: true } : {}) });
840 }
842 /** Land never queues: with the merge queue on, the server refuses it (#39). */
843 land(message: string): Promise<Exclude<PublishAnswer, { queued: number }>> {
pinch26Publish and log fixes, and a flaky test removed. - A publish or a land now waits up to 150 s for the server's answer, not 30 s. The server may work on one request for up to 2 minutes, so a slow merge was reported as failed and then landed. - abso log reads any length of history. The server sends at most 200 versions a page, and the client now follows its pages: -n 2000 gives 2000, and --since or a folder reads up to 1000. abso log --before <version> starts below that version. The end of the list names the --before for the next older ones, and a filtered read says when it stopped short. - The test 'sends one run, and takes each command as one quoted word' is removed: it failed on Windows about half the time. The stand-in server the client tests use no longer closes idle kept-alive connections, which other tests also tripped on under load (ECONNRESET). Check: 722 pass, 0 fail.Compare844 return this.json("POST", this.agentPath("land"), { message }, undefined, PUBLISH_TIMEOUT_MS);
init0Start the project845 }
847 draftSync(): Promise<DraftSyncAnswer> {
848 return this.json("POST", this.agentPath("draft-sync"), {});
849 }
851 blame(file: string, from?: number, to?: number, version?: number, view: View = {}): Promise<BlameAnswer> {
852 return this.json("GET", `/blame?${query({ file, from, to, version, ...view })}`);
853 }
855 /** The paths in the agent's view: what its folder should hold (#37). */
856 viewFiles(): Promise<FilesAnswer> {
857 return this.json("GET", this.agentPath("files"));
858 }
860 /** The paths in shared, or a named draft, at a version (the newest by default). */
861 filesAt(draft: string | null, version?: number): Promise<FilesAnswer> {
862 return this.json("GET", `/files?${query({ draft, version })}`);
863 }
865 /** The versions of a space, newest first; with `path`, only those that changed it. */
pinch26Publish and log fixes, and a flaky test removed. - A publish or a land now waits up to 150 s for the server's answer, not 30 s. The server may work on one request for up to 2 minutes, so a slow merge was reported as failed and then landed. - abso log reads any length of history. The server sends at most 200 versions a page, and the client now follows its pages: -n 2000 gives 2000, and --since or a folder reads up to 1000. abso log --before <version> starts below that version. The end of the list names the --before for the next older ones, and a filtered read says when it stopped short. - The test 'sends one run, and takes each command as one quoted word' is removed: it failed on Windows about half the time. The stand-in server the client tests use no longer closes idle kept-alive connections, which other tests also tripped on under load (ECONNRESET). Check: 722 pass, 0 fail.Compare866 /**
867 * The versions newest first, below `before` when it's given. The server
868 * sends at most LOG_PAGE at a time, so a longer log is read page by page,
869 * following each page's next. `next` on the answer says older ones are left.
870 */
871 async log(where: Where, limit?: number, path?: string, before?: number): Promise<LogAnswer> {
872 let page = await this.#logPage(where, limit === undefined ? undefined : Math.min(limit, LOG_PAGE), path, before);
873 const versions = [...page.versions];
874 while (limit !== undefined && versions.length < limit && page.next !== undefined) {
875 page = await this.#logPage(where, Math.min(limit - versions.length, LOG_PAGE), path, page.next);
876 versions.push(...page.versions);
877 }
878 const { next, ...rest } = page;
879 return { ...rest, versions, ...(next !== undefined ? { next } : {}) };
880 }
882 #logPage(
883 where: Where,
884 limit: number | undefined,
885 path: string | undefined,
886 before: number | undefined,
887 ): Promise<LogAnswer> {
888 return this.json("GET", `/log?${query({ ...where, limit, path, before })}`);
init0Start the project889 }
891 show(version: number, where: Where): Promise<ShowAnswer> {
892 return this.json("GET", `/show?${query({ version, ...where })}`);
893 }
895 fileAt(path: string, version: number, where: Where): Promise<{ path: string; version: number; text: string | null }> {
896 return this.json("GET", `/file?${query({ path, version, ...where })}`);
897 }
899 compare(from: number, to: number, where: Where): Promise<{ from: number; to: number; files: readonly FileChange[] }> {
900 return this.json("GET", `/compare?${query({ from, to, ...where })}`);
candidates186Read a version of shared without some earlier versions: abso show <N> --without A,B shows what differs and abso export <dir> --version N --without A,B writes the files. The server's GET without?version=&versions= checks the set left exactly as asked: when a version it keeps builds on one left out, it refuses with that chain, the files and the wider set that works, and never widens it. Atoms keep their ids and authors; shared and its log don't change; the same ask gives the same tree hash.Compare901 }
903 /** Version `version` of shared with `versions` left out, or the refusal naming what builds on them. */
904 without(version: number, versions: readonly number[]): Promise<WithoutAnswer> {
905 return this.json("GET", `/without?${query({ version, versions: versions.join(",") })}`);
init0Start the project906 }
908 /** A message to the project's other agents (or those named), delivered once as news. */
909 starting(
910 text: string | null,
911 files?: readonly string[],
912 options: { issue?: number; done?: boolean } = {},
913 ): Promise<{
914 starting: { text: string; files: readonly string[]; time: number; issue?: number } | null;
915 overlaps: readonly Overlap[];
916 }> {
917 return this.json("POST", this.agentPath("starting"), {
918 text,
919 ...(files && files.length > 0 ? { files } : {}),
920 ...(options.issue !== undefined ? { issue: options.issue } : {}),
921 ...(options.done ? { done: true } : {}),
922 });
923 }
925 announce(text: string, to?: readonly string[]): Promise<{ id: number; to: readonly string[] }> {
926 return this.json("POST", this.agentPath("announce"), { text, ...(to ? { to } : {}) });
927 }
929 /** The news waiting for this agent, handed over once. */
930 news(): Promise<{ news: News; items?: readonly { readonly text: string; readonly at: number | null }[] }> {
931 return this.json("POST", this.agentPath("news"), {});
932 }
934 /** This agent's unpublished changes, file by file. */
935 diff(): Promise<DiffAnswer> {
936 return this.json("POST", this.agentPath("diff"), {});
937 }
pinch52abso diff --agent <name>: review another agent's unpublished changes Reviewing a teammate's work before it's published had no command: abso diff showed only your own draft, and abso status names files but not lines. Reviewers read the other agent's folder on disk, which only works on a shared machine and shows their disk, not what they recorded. abso diff --agent alice now prints alice's recorded, unpublished changes line by line, the way abso diff prints yours: "alice's recorded, unpublished changes in shared (on version 12): 2 files, 5 lines added, 1 removed." Paths narrow it as usual. It reads what the server holds, the same route the website's drafts use, so it records nothing and changes nothing. An agent with no changes says so; a name the project doesn't know is refused by the server. --agent doesn't go with two versions or --draft. The test server answers GET /p/:project/diff?agent= as the Worker does. Tested in client.test.ts.Compare938
939 /** Another agent's recorded, unpublished changes, file by file: read only, as the website's drafts show them. */
940 diffOf(agent: string): Promise<DiffAnswer> {
941 return this.json("GET", `/diff?${query({ agent })}`);
942 }
init0Start the project943
944 /** Discard this agent's unpublished changes to `files` (null: all of them). */
945 restore(files: readonly string[] | null): Promise<RestoreAnswer> {
946 return this.json("POST", this.agentPath("restore"), files === null ? { all: true } : { files });
947 }
whytrail193abso why follows a line back past formatting to its reason, and names git commits why now lists a line's earlier changes, newest first, with what the line read before each. A change that rewrote a line left the line it replaced in the file's history; why pairs the two (same code formatted differently, the same code rewrapped, or the most similar line) and follows the pairs back. A change that only touched formatting (whitespace, line wrapping, quotes, trailing commas, line-end semicolons, parentheses around a lone arrow parameter) is skipped by default, and why names it: 'Skipped 1 formatting change since: version 366'. --all shows those too. --at <version> reads the line as it was at that version. A push imported from git (client/scripts/import-git.ts, or a plain git push) names its commit and author in why and blame. import-git.ts now also records where the repository's issues are, from origin on GitHub or GitLab or --issues, and why says which issue #N in an imported message or line means. A project imported before this can say it once in abso.json: "gitIssues": "https://github.com/owner/repo/issues". Closes issues 20 and 21's tool side.Compare949 why(file: string, line: number, view: View = {}, version?: number): Promise<WhyAnswer> {
950 return this.json("GET", `/why?${query({ file, line, version, ...view })}`);
init0Start the project951 }
953 where(): Promise<WhereAnswer> {
954 return this.json("GET", "/where");
955 }
957 /**
958 * Send the folder as a tar.gz and run a command in the agent's box. Output
959 * goes to `io.out` as it arrives, and the box's stderr to `io.err` (the
960 * server keeps them apart when asked; an older one sends both as out).
961 * Answers the command's exit code.
962 *
963 * When the stream breaks before the exit line and the server gave the run
964 * an id, the run goes on in the box: this reconnects to it and carries on
965 * from the last output printed, so nothing is lost or printed twice. The
966 * command itself is never sent twice.
967 */
968 async run(command: string, tarGz: Uint8Array<ArrayBuffer>, io: RunIO): Promise<number> {
969 const res = await postRun(this, command, tarGz, io.onRetry, io.replace, io.fresh);
pinch54The client and the edit mods send and read X-Abso-* headers only (Client, Name, Run-Key, Kind, Admin; Run, Box, Prep from answers). Servers have read X-Abso-* beside the old names for a while and answer under both, so this works with any current server.Compare970 // X-Abso-Box: cold means the box started for this run; X-Abso-Prep says whether it started from the prep (#37).
971 io.onBox?.(res.headers.get("x-abso-box") === "cold", res.headers.get("x-abso-prep") ?? undefined);
972 return follow(this, res, res.headers.get("x-abso-run"), { at: 0, errAt: 0 }, io);
init0Start the project973 }
975 /**
976 * Start a run and answer its id without waiting: the job goes on in the box
977 * after this connection closes (abso run --detach; abso logs <id> follows it).
978 */
979 async startRun(
980 command: string,
981 tarGz: Uint8Array<ArrayBuffer>,
982 onRetry?: (why: string, attempt: number) => void,
983 replace = false,
984 ): Promise<string> {
985 const res = await postRun(this, command, tarGz, onRetry, replace);
pinch54The client and the edit mods send and read X-Abso-* headers only (Client, Name, Run-Key, Kind, Admin; Run, Box, Prep from answers). Servers have read X-Abso-* beside the old names for a while and answer under both, so this works with any current server.Compare986 const id = res.headers.get("x-abso-run");
init0Start the project987 if (id === null) {
988 // No id: the box failed before the job started ({"error"} in the body), or the server can't detach.
989 await consumeRun(res, { out: () => {} }, { at: 0, errAt: 0 });
990 throw new ApiError("this server gives runs no id, so a run can't be detached");
991 }
992 await res.body?.cancel();
993 return id;
994 }
996 /** A run's output from its start, for as long as the box keeps it, until it ends (abso logs). Answers its exit code. */
997 async logs(id: string, io: RunIO): Promise<number> {
998 let res: Response;
999 try {
pinch88Every request a folder's Api makes goes through one send(): a folder that reads signed out sends only GETs and follows no redirect on every path, box runs and serve included.Compare1000 res = await this.send(followUrl(this, id, { at: 0, errAt: 0 }), { headers: this.headers() });
init0Start the project1001 } catch (err) {
1002 const e = err as Error;
1003 throw new ApiError(
1004 `could not reach ${this.config.server}: ${(e.cause as Error | undefined)?.message ?? e.message}`,
1005 );
1007 if (res.status === 404) throw new ApiError(`no run ${id} in this box: ${errorSentence(await res.text())}`, 404);
1008 if (!res.ok || res.body === null)
1009 throw new ApiError(`logs answered ${res.status}: ${errorSentence(await res.text())}`, res.status);
1010 return follow(this, res, id, { at: 0, errAt: 0 }, io);