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 276 to 277

Compare

+26 −1 in 5 places
Lines 4–10 at 277 (were 4–9 at 276)
44
55import { randomUUID } from "node:crypto";
66import { setDefaultResultOrder } from "node:dns";
7+import { CALLER_HEADER } from "../../src/caller.ts";
78import type {
89 ChangeAnswer,
910 DraftSyncAnswer,
Lines 142–164 at 277 (were 141–146 at 276)
141142 | { dryRun: true; plan: CopyPlan }
142143 | { ok: true; id: number; from: { project: string; issue: number }; skipped: { comments: number[]; asks: number[] } };
143144
145+/**
146+ * The server's line when another chat just used this seat (seatNotice on an answer): kept until main() prints it with
147+ * the news, once however many answers carried it.
148+ */
149+const seatNotices = new Set<string>();
150+function noteSeat(answer: unknown): void {
151+ if (typeof answer !== "object" || answer === null || Array.isArray(answer)) return;
152+ const line = (answer as { seatNotice?: unknown }).seatNotice;
153+ if (typeof line === "string" && line !== "" && line.length <= 300 && !/[\u0000-\u001f]/.test(line))
154+ seatNotices.add(line);
155+}
156+export function takeSeatNotices(): string[] {
157+ const out = [...seatNotices];
158+ seatNotices.clear();
159+ return out;
160+}
144162export class Api {
145163 readonly config: Config;
146164 readonly timeoutMs: number;
Lines 187–195 at 277 (were 169–174 at 276)
169187 /** The Issues Worker (#54) this folder's issues calls go to; set by the issues commands (issues.ts). */
170188 issuesServer: string | undefined;
171189
190+ /** Who is calling this seat (src/caller.ts): this chat's session, this computer and this folder. Set by open(). */
191+ caller: string | undefined;
172193 url(path: string, server = this.config.server): string {
173194 return `${server.replace(/\/+$/, "")}/p/${encodeURIComponent(this.config.project)}${path}`;
174195 }
Lines 203–210 at 277 (were 182–187 at 276)
182203 // Which client made the call (#29); the mods send theirs too.
183204 "x-abso-client": `abso-cli/${clientVersion()}`,
184205 ...(this.config.token && !this.config.visitor ? { authorization: `Bearer ${this.config.token}` } : {}),
206+ // A visitor says nothing about where it's reading from.
207+ ...(this.caller !== undefined && !this.config.visitor ? { [CALLER_HEADER]: this.caller } : {}),
185208 ...(contentType ? { "content-type": contentType } : {}),
186209 };
187210 }
Lines 281–289 at 277 (were 258–264 at 276)
258281 res.status,
259282 );
260283 try {
261− return JSON.parse(text) as T;
284+ const parsed = JSON.parse(text) as T;
285+ noteSeat(parsed);
286+ return parsed;
262287 } catch {
263288 throw new ApiError(
264289 `${method} ${path} answered with something that isn't JSON: ${text.slice(0, 300)}`,
MCP
compare on this site's /mcp
CLI
abso diff 276 277 client/src/api.ts --json
JSON
/christopher/abso-core/compare/276..277?file=client%2Fsrc%2Fapi.ts&format=json