Skip to content

abso-core

Public

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

Check passed

Versions 25 to 26

Compare

+50 −6 in 5 places
Lines 85–101 at 26 (were 85–90 at 25)
8585 return sent === undefined ? baseMs : baseMs + Math.floor(Buffer.byteLength(sent) / 100_000) * 1000;
8686}
8787
88+/**
89+ * How long a publish or a land may take before the client stops waiting: the
90+ * server gives one request up to 2 minutes of work, so a small body can still
91+ * take that long (a large merge). Waiting less reported publishes as failed
92+ * that went on to land.
93+ */
94+export const PUBLISH_TIMEOUT_MS = 150_000;
96+/** The most versions the server's log sends at once. */
97+export const LOG_PAGE = 200;
8899/** A query string from the values that are set (null and undefined are left out). */
89100function query(values: Record<string, string | number | null | undefined>): URLSearchParams {
90101 const q = new URLSearchParams();
Lines 179–194 at 26 (were 168–177 at 25)
168179 };
169180 }
170181
171− async json<T>(method: "GET" | "POST", path: string, body?: unknown, server = this.config.server): Promise<T> {
182+ async json<T>(
183+ method: "GET" | "POST",
184+ path: string,
185+ body?: unknown,
186+ server = this.config.server,
187+ atLeastMs = 0,
188+ ): Promise<T> {
172189 let res: Response | undefined;
173190 const sent = body === undefined ? undefined : JSON.stringify(body);
174− const timeoutMs = timeoutFor(this.timeoutMs, sent);
191+ const timeoutMs = Math.max(atLeastMs, timeoutFor(this.timeoutMs, sent));
175192 // A connection that never opened is tried once more, IPv4 first (#37, GAME - UI/UX: one IPv6
176193 // address timed out, and the same command went through seconds later). Nothing went out, so
177194 // a POST is as safe to send again as a GET.
Lines 392–404 at 26 (were 375–381 at 25)
375392 }
376393
377394 publish(message: string, asIs = false): Promise<PublishAnswer> {
378− return this.json("POST", this.agentPath("publish"), { message, ...(asIs ? { asIs: true } : {}) });
395+ return this.json(
396+ "POST",
397+ this.agentPath("publish"),
398+ { message, ...(asIs ? { asIs: true } : {}) },
399+ undefined,
400+ PUBLISH_TIMEOUT_MS,
401+ );
379402 }
380403
381404 /** One change (#44). */
Lines 732–738 at 26 (were 709–715 at 25)
709732
710733 /** Land never queues: with the merge queue on, the server refuses it (#39). */
711734 land(message: string): Promise<Exclude<PublishAnswer, { queued: number }>> {
712− return this.json("POST", this.agentPath("land"), { message });
735+ return this.json("POST", this.agentPath("land"), { message }, undefined, PUBLISH_TIMEOUT_MS);
713736 }
714737
715738 draftSync(): Promise<DraftSyncAnswer> {
Lines 754–784 at 26 (were 731–740 at 25)
731754 }
732755
733756 /** The versions of a space, newest first; with `path`, only those that changed it. */
734− log(where: Where, limit?: number, path?: string): Promise<LogAnswer> {
735− return this.json("GET", `/log?${query({ ...where, limit, path })}`);
757+ /**
758+ * The versions newest first, below `before` when it's given. The server
759+ * sends at most LOG_PAGE at a time, so a longer log is read page by page,
760+ * following each page's next. `next` on the answer says older ones are left.
761+ */
762+ async log(where: Where, limit?: number, path?: string, before?: number): Promise<LogAnswer> {
763+ let page = await this.#logPage(where, limit === undefined ? undefined : Math.min(limit, LOG_PAGE), path, before);
764+ const versions = [...page.versions];
765+ while (limit !== undefined && versions.length < limit && page.next !== undefined) {
766+ page = await this.#logPage(where, Math.min(limit - versions.length, LOG_PAGE), path, page.next);
767+ versions.push(...page.versions);
768+ }
769+ const { next, ...rest } = page;
770+ return { ...rest, versions, ...(next !== undefined ? { next } : {}) };
736771 }
737772
773+ #logPage(
774+ where: Where,
775+ limit: number | undefined,
776+ path: string | undefined,
777+ before: number | undefined,
778+ ): Promise<LogAnswer> {
779+ return this.json("GET", `/log?${query({ ...where, limit, path, before })}`);
780+ }
738782 show(version: number, where: Where): Promise<ShowAnswer> {
739783 return this.json("GET", `/show?${query({ version, ...where })}`);
740784 }
MCP
compare on this site's /mcp
CLI
abso diff 25 26 client/src/api.ts --json
JSON
/christopher/abso-core/compare/25..26?file=client%2Fsrc%2Fapi.ts&format=json