{"version":259,"agent":"approvals-page","message":"Box sign-ins asked of a person (abso 684, client; Security's yes with changes on ask 2097). In an agent's folder on the same server, abso login also asks a person in that project to approve it, through POST /login/ask with the folder's agent key and this client's own device code, then an ordinary abso ask (to person:<id>) with the request link, linked with /login/ask/link. It says who it asked and until when, keeps the code link as a fallback, says who turned it down on a deny, and withdraws its ask when nobody answers in time. --no-ask shows the code only. Tests: client/test/box.test.ts, three new (abso 684).","time":1792093041064,"timeIso":"2026-10-15T19:37:21.064Z","changes":3,"change":3998,"files":["client/src/box.ts","client/src/main.ts","client/test/box.test.ts"],"draft":null,"diff":[{"path":"client/src/box.ts","added":52,"removed":8,"diff":"--- a/client/src/box.ts\n+++ b/client/src/box.ts\n@@ -222,7 +222,7 @@\n }\n \n /** This machine's name, as the server takes a box's name: 1-64 letters, digits, '.', '_' or '-'. */\n-function boxName(): string {\n+export function boxName(): string {\n \tconst name = hostname()\n \t\t.replace(/[^A-Za-z0-9._-]/g, \"-\")\n \t\t.replace(/^[^A-Za-z0-9]+/, \"\")\n@@ -254,8 +254,29 @@\n \treadonly say: (line: string) => void;\n \t/** Opens the approve page in a browser, answering whether it tried. None where it shouldn't (--no-browser, SSH, CI). */\n \treadonly open?: (url: string) => boolean;\n+\t/**\n+\t * abso 684: in a joined folder, asks a person in its project to approve this sign-in, through an abso ask, so nobody\n+\t * relays the code. Answers who was asked, or null to fall back to the code alone.\n+\t */\n+\treadonly ask?: (codes: { readonly device: string; readonly user: string }) => Promise<LoginAsked | null>;\n }\n \n+/** A sign-in asked of people (abso 684). */\n+export interface LoginAsked {\n+\treadonly project: string;\n+\t/** \"the person who approved this agent's box\", or \"the owners of <project>\". */\n+\treadonly who: string;\n+\treadonly asks: readonly number[];\n+\t/** Milliseconds: when the asked sign-in runs out. */\n+\treadonly expiresAt: number;\n+\t/** The most the box may be granted: the asking agent's own role. */\n+\treadonly role: string;\n+\t/** Withdraws the asks once nobody answered in time. */\n+\treadonly withdraw: () => Promise<void>;\n+}\n+\n+const CENTRAL = new Intl.DateTimeFormat(\"en-US\", { timeZone: \"America/Chicago\", hour: \"numeric\", minute: \"2-digit\" });\n+\n /**\n  * Asks `server` for a code, shows it with its link, and waits for a person to\n  * approve it. Answers the box's record, already written to the config folder.\n@@ -278,16 +299,29 @@\n \tif (typeof code !== \"string\" || typeof link !== \"string\" || typeof device !== \"string\")\n \t\tthrow new UsageError(`${originOf(server)} didn't give a code to approve`);\n \t// The page opens with the code in it, so nobody copies a link by hand. The link and code are printed all the same.\n-\tif (io.open?.(link)) io.say(\"Opening the approve page in your browser.\");\n-\tio.say(`To sign this box in, open ${link} and approve the code ${code}.`);\n-\tio.say(\"Waiting for approval. Ctrl-C stops waiting, and abso stops by itself when the code runs out.\");\n-\tconst until = now() + expiresIn * 1000;\n+\tconst asked = io.ask ? await io.ask({ device, user: code }).catch(() => null) : null;\n+\tif (asked) {\n+\t\tconst askWord = asked.asks.length === 1 ? `ask ${asked.asks[0]}` : `asks ${asked.asks.join(\", \")}`;\n+\t\tio.say(`Asked ${asked.who} (${askWord} in ${asked.project}) to sign this box in, as at most ${asked.role}.`);\n+\t\tio.say(\n+\t\t\t`Waiting for their answer, until ${CENTRAL.format(new Date(asked.expiresAt))} CT. To approve it yourself instead: ${link}`,\n+\t\t);\n+\t} else {\n+\t\tif (io.open?.(link)) io.say(\"Opening the approve page in your browser.\");\n+\t\tio.say(`To sign this box in, open ${link} and approve the code ${code}.`);\n+\t\tio.say(\"Waiting for approval. Ctrl-C stops waiting, and abso stops by itself when the code runs out.\");\n+\t}\n+\tconst until = asked ? Math.min(asked.expiresAt, now() + MAX_LOGIN_WAIT_S * 1000) : now() + expiresIn * 1000;\n \tlet toldAt = now();\n \twhile (now() < until) {\n \t\tawait sleep(interval * 1000);\n \t\t// A wait with no word looks like a hang, so say it's still waiting now and then.\n \t\tif (now() - toldAt >= STILL_WAITING_MS) {\n-\t\t\tio.say(`Still waiting for the code ${code} to be approved.`);\n+\t\t\tio.say(\n+\t\t\t\tasked\n+\t\t\t\t\t? `Still waiting (${asked.who} hasn't answered yet).`\n+\t\t\t\t\t: `Still waiting for the code ${code} to be approved.`,\n+\t\t\t);\n \t\t\ttoldAt = now();\n \t\t}\n \t\tconst a = await call(server, \"/login/token\", { device_code: device }, undefined, fetcher);\n@@ -297,8 +331,14 @@\n \t\t\t\tinterval += 5;\n \t\t\t\tcontinue;\n \t\t\t}\n-\t\t\tif (a.body.error === \"access_denied\") throw new UsageError(`the code ${code} was turned down.`);\n-\t\t\tthrow new UsageError(`the code ${code} ran out. Run abso login again.`);\n+\t\t\tif (a.body.error === \"access_denied\")\n+\t\t\t\tthrow new UsageError(asked ? `${asked.who} turned this sign-in down.` : `the code ${code} was turned down.`);\n+\t\t\tif (asked) await asked.withdraw().catch(() => undefined);\n+\t\t\tthrow new UsageError(\n+\t\t\t\tasked\n+\t\t\t\t\t? \"nobody answered in time, so nothing was granted. Run abso login again.\"\n+\t\t\t\t\t: `the code ${code} ran out. Run abso login again.`,\n+\t\t\t);\n \t\t}\n \t\tconst { box_token: credential, box_id: id, grant, expires_at } = a.body;\n \t\tconst expiresAt = typeof expires_at === \"string\" ? Date.parse(expires_at) : Number.NaN;\n@@ -308,6 +348,10 @@\n \t\twriteBox(record, home);\n \t\treturn record;\n \t}\n+\tif (asked) {\n+\t\tawait asked.withdraw().catch(() => undefined);\n+\t\tthrow new UsageError(\"nobody answered in time, so nothing was granted. Run abso login again.\");\n+\t}\n \tthrow new UsageError(`nobody approved the code ${code} in time. Run abso login again.`);\n }\n "},{"path":"client/src/main.ts","added":67,"removed":4,"diff":"--- a/client/src/main.ts\n+++ b/client/src/main.ts\n@@ -8,7 +8,7 @@\n import { bool, type FlagSpec, type Parsed, parseArgs, str, UsageError } from \"./args.ts\";\n import { runAutosettle } from \"./autosettle-commands.ts\";\n import { bodyFilesHelp, readBodyFiles, withBodyFiles } from \"./body-files.ts\";\n-import { boxPublic, boxText, login, loginRequest, logout, readBox } from \"./box.ts\";\n+import { boxName, boxPublic, boxText, login, loginRequest, logout, originOf, readBox } from \"./box.ts\";\n import { runDiff, runFiles, runLog, runRestore, runShow } from \"./changes.ts\";\n import { runCheckIgnore } from \"./check-ignore.ts\";\n import { runCi } from \"./ci.ts\";\n@@ -45,7 +45,17 @@\n import { runExport } from \"./export.ts\";\n import { runGroup, runGroups } from \"./group-commands.ts\";\n import { runBlame, runWhere, runWho, runWhy } from \"./history.ts\";\n-import { runAck, runAnswer, runAsk, runIssue, runIssues, runReply, runSearch, runWaiting } from \"./issues.ts\";\n+import {\n+\topenIssues,\n+\trunAck,\n+\trunAnswer,\n+\trunAsk,\n+\trunIssue,\n+\trunIssues,\n+\trunReply,\n+\trunSearch,\n+\trunWaiting,\n+} from \"./issues.ts\";\n import { adminToken, issuedPublic, keyList, keyListText, keyNew, keyRevoke } from \"./key-admin.ts\";\n import { browserSkip, openInBrowser } from \"./open-browser.ts\";\n import { runOrg, runOrgs } from \"./orgs.ts\";\n@@ -189,13 +199,15 @@\n \t\tflags: {\n \t\t\tserver: \"string\",\n \t\t\t\"no-browser\": \"boolean\",\n+\t\t\t\"no-ask\": \"boolean\",\n \t\t\tprojects: \"string\",\n \t\t\trole: \"string\",\n \t\t\tdays: \"string\",\n \t\t},\n-\t\tusage: \"abso login [--no-browser] [--projects <name,name>] [--role <reader|writer|owner>] [--days <1-90>]\",\n+\t\tusage:\n+\t\t\t\"abso login [--no-browser] [--no-ask] [--projects <name,name>] [--role <reader|writer|owner>] [--days <1-90>]\",\n \t\tabout:\n-\t\t\t\"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.\",\n+\t\t\t\"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.\",\n \t\trun: async (args, env) => {\n \t\t\tconst server = boxServer(args, env);\n \t\t\tconst open =\n@@ -203,6 +215,7 @@\n \t\t\t\t\t? undefined\n \t\t\t\t\t: (url: string) => openInBrowser(url);\n \t\t\tconst record = await login(server, {\n+\t\t\t\task: bool(args, \"no-ask\") ? undefined : loginAsk(server, env),\n \t\t\t\trequest: loginRequest(args),\n \t\t\t\tsay: (line) => process.stderr.write(terminalText(`${line}\\n`, colorsPass(process.stderr, env.env))),\n \t\t\t\topen,\n@@ -1063,3 +1076,53 @@\n \t\t};\n \t}\n }\n+\n+/**\n+ * abso 684: in an agent's folder on this same server, the ask `abso login` makes of a person in that project, so nobody\n+ * relays the code. The folder's agent key proves the agent; the device code proves the sign-in is this client's own.\n+ * Null outside such a folder, or when nobody could be asked: login then shows the code alone.\n+ */\n+function loginAsk(server: string, env: Env): NonNullable<Parameters<typeof login>[1][\"ask\"]> | undefined {\n+\tconst root = findRoot(env.cwd);\n+\tif (root === undefined || isVisitor(root)) return undefined;\n+\tconst config = readConfig(root, env.env);\n+\tif (config.token === undefined || originOf(config.server) !== originOf(server)) return undefined;\n+\treturn async ({ device, user }) => {\n+\t\tconst asked = await fetch(`${originOf(server)}/login/ask`, {\n+\t\t\tmethod: \"POST\",\n+\t\t\theaders: { \"content-type\": \"application/json\", authorization: `Bearer ${config.token}` },\n+\t\t\tbody: JSON.stringify({ project: config.project, agent: config.agent, device_code: device, user_code: user }),\n+\t\t});\n+\t\tconst body = (await asked.json().catch(() => ({}))) as {\n+\t\t\terror?: string;\n+\t\t\tpeople?: string[];\n+\t\t\texpires_at?: string;\n+\t\t\trequest_url?: string;\n+\t\t\trole?: string;\n+\t\t};\n+\t\tif (!asked.ok || !Array.isArray(body.people) || typeof body.request_url !== \"string\") return null;\n+\t\tconst expiresAt = Date.parse(body.expires_at ?? \"\");\n+\t\tconst { api } = openIssues(env);\n+\t\tconst when = new Intl.DateTimeFormat(\"en-US\", { timeZone: \"America/Chicago\", hour: \"numeric\", minute: \"2-digit\" });\n+\t\tconst question = `Please sign in my box \"${boxName()}\" for ${config.project}, as at most ${body.role}. It expires at ${when.format(new Date(expiresAt))} CT. Approve or deny: ${body.request_url}`;\n+\t\tconst asks: number[] = [];\n+\t\tfor (const of of body.people) asks.push((await api.ask({ of, question })).id);\n+\t\tconst first = asks[0];\n+\t\tif (first !== undefined)\n+\t\t\tawait fetch(`${originOf(server)}/login/ask/link`, {\n+\t\t\t\tmethod: \"POST\",\n+\t\t\t\theaders: { \"content-type\": \"application/json\" },\n+\t\t\t\tbody: JSON.stringify({ device_code: device, ask: first }),\n+\t\t\t});\n+\t\treturn {\n+\t\t\tproject: config.project,\n+\t\t\twho: body.people.length === 1 ? \"the person who approved this agent's box\" : `the owners of ${config.project}`,\n+\t\t\tasks,\n+\t\t\texpiresAt,\n+\t\t\trole: body.role ?? \"writer\",\n+\t\t\twithdraw: async () => {\n+\t\t\t\tfor (const id of asks) await api.withdraw(id, { note: \"The sign-in ran out; nothing was granted.\" });\n+\t\t\t},\n+\t\t};\n+\t};\n+}"},{"path":"client/test/box.test.ts","added":94,"removed":0,"diff":"--- a/client/test/box.test.ts\n+++ b/client/test/box.test.ts\n@@ -458,3 +458,97 @@\n \t\t/Projects: all of yours, now and later \\(writer at most\\)\\. abso init makes a new one/,\n \t);\n });\n+\n+// abso 684: in an agent's folder, login asks a person in the project instead of relaying the code.\n+function askedOf(withdrawn: number[]): NonNullable<Parameters<typeof login>[1][\"ask\"]> {\n+\treturn async ({ device, user }) => {\n+\t\tassert.equal(device, started.device_code, \"the ask is made with this client's own device code\");\n+\t\tassert.equal(user, started.user_code);\n+\t\treturn {\n+\t\t\tproject: \"abso\",\n+\t\t\twho: \"the person who approved this agent's box\",\n+\t\t\tasks: [41],\n+\t\t\texpiresAt: Date.parse(\"2026-10-15T19:30:00Z\"),\n+\t\t\trole: \"writer\",\n+\t\t\twithdraw: async () => void withdrawn.push(41),\n+\t\t};\n+\t};\n+}\n+\n+test(\"an asked login says who was asked and until when, and doesn't lead with the code (abso 684)\", async () => {\n+\tconst said: string[] = [];\n+\tconst c = clock();\n+\tawait login(\n+\t\tSERVER,\n+\t\t{\n+\t\t\task: askedOf([]),\n+\t\t\tfetch: server(\n+\t\t\t\t[\n+\t\t\t\t\t[200, started],\n+\t\t\t\t\t[200, { box_id: \"b_test\", box_token: CREDENTIAL, expires_at: EXPIRES, grant: { projects: [] } }],\n+\t\t\t\t],\n+\t\t\t\t[],\n+\t\t\t),\n+\t\t\tsleep: c.sleep,\n+\t\t\tnow: c.now,\n+\t\t\tsay: (line) => said.push(line),\n+\t\t},\n+\t\thome(),\n+\t);\n+\tassert.match(\n+\t\tsaid[0]!,\n+\t\t/^Asked the person who approved this agent's box \\(ask 41 in abso\\) to sign this box in, as at most writer\\.$/,\n+\t);\n+\tassert.match(said[1]!, /^Waiting for their answer, until .* CT\\. To approve it yourself instead: /);\n+\tassert.doesNotMatch(said.join(\"\\n\"), /approve the code/);\n+});\n+\n+test(\"an asked login that's turned down says who turned it down (abso 684)\", async () => {\n+\tconst c = clock();\n+\tawait assert.rejects(\n+\t\tlogin(\n+\t\t\tSERVER,\n+\t\t\t{\n+\t\t\t\task: askedOf([]),\n+\t\t\t\tfetch: server(\n+\t\t\t\t\t[\n+\t\t\t\t\t\t[200, started],\n+\t\t\t\t\t\t[400, { error: \"access_denied\" }],\n+\t\t\t\t\t],\n+\t\t\t\t\t[],\n+\t\t\t\t),\n+\t\t\t\tsleep: c.sleep,\n+\t\t\t\tnow: c.now,\n+\t\t\t\tsay: () => {},\n+\t\t\t},\n+\t\t\thome(),\n+\t\t),\n+\t\t/the person who approved this agent's box turned this sign-in down/,\n+\t);\n+});\n+\n+test(\"an asked login that nobody answers withdraws its ask and grants nothing (abso 684)\", async () => {\n+\tconst withdrawn: number[] = [];\n+\tconst c = clock();\n+\tawait assert.rejects(\n+\t\tlogin(\n+\t\t\tSERVER,\n+\t\t\t{\n+\t\t\t\task: askedOf(withdrawn),\n+\t\t\t\tfetch: server(\n+\t\t\t\t\t[\n+\t\t\t\t\t\t[200, started],\n+\t\t\t\t\t\t[400, { error: \"expired_token\" }],\n+\t\t\t\t\t],\n+\t\t\t\t\t[],\n+\t\t\t\t),\n+\t\t\t\tsleep: c.sleep,\n+\t\t\t\tnow: c.now,\n+\t\t\t\tsay: () => {},\n+\t\t\t},\n+\t\t\thome(),\n+\t\t),\n+\t\t/nobody answered in time, so nothing was granted/,\n+\t);\n+\tassert.deepEqual(withdrawn, [41]);\n+});"}],"ci":null}