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 57 to 58

Compare

+14 −1 in 2 places
Lines 174–184 at 58 (were 174–179 at 57)
174174 );
175175}
176176
177+/** The longest login waits for approval, whatever the server says. */
178+const MAX_LOGIN_WAIT_S = 30 * 60;
179+/** How often login says it's still waiting. */
180+const STILL_WAITING_MS = 60_000;
177182export interface LoginIo {
178183 readonly fetch?: typeof fetch;
179184 readonly sleep?: (ms: number) => Promise<void>;
Lines 198–218 at 58 (were 193–205 at 57)
193198 const start = await call(server, "/login/device", { name: boxName(), client: "abso" }, undefined, fetcher);
194199 const { device_code: device, user_code: code, verification_uri_complete: link } = start.body;
195200 let interval = Number(start.body.interval) || 5;
196− const expiresIn = Number(start.body.expires_in) || 900;
201+ // The server says when its code runs out; a server that says never still gets an end.
202+ const expiresIn = Math.min(Number(start.body.expires_in) || 900, MAX_LOGIN_WAIT_S);
197203 if (typeof code !== "string" || typeof link !== "string" || typeof device !== "string")
198204 throw new UsageError(`${originOf(server)} didn't give a code to approve`);
199205 io.say(`To sign this box in, open ${link} and approve the code ${code}.`);
206+ io.say("Waiting for approval. Ctrl-C stops waiting, and abso stops by itself when the code runs out.");
200207 const until = now() + expiresIn * 1000;
208+ let toldAt = now();
201209 while (now() < until) {
202210 await sleep(interval * 1000);
211+ // A wait with no word looks like a hang, so say it's still waiting now and then.
212+ if (now() - toldAt >= STILL_WAITING_MS) {
213+ io.say(`Still waiting for the code ${code} to be approved.`);
214+ toldAt = now();
215+ }
203216 const a = await call(server, "/login/token", { device_code: device }, undefined, fetcher);
204217 if (a.status === 400) {
205218 if (a.body.error === "authorization_pending") continue;
MCP
compare on this site's /mcp
CLI
abso diff 57 58 client/src/box.ts --json
JSON
/christopher/abso-core/compare/57..58?file=client%2Fsrc%2Fbox.ts&format=json