Versions 116 to 318
Lines 9–15 at 318 (were 9–14 at 116)
Lines 32–37 at 318 (were 31–37 at 116)
34− max_agents: 5,
3737const record = { server: SERVER, id: "b_0123abcd", credential: CREDENTIAL, grant, expiresAt: Date.parse(EXPIRES) };
Lines 70–90 at 318 (were 70–92 at 116)
7272
73−test("login grant options validate project lists, roles, limits and duration", () => {
79− "max-agents": "string",
84− assert.deepEqual(request("--projects", "alpha, beta,alpha", "--max-agents", "1", "--days", "30"), {
89− max_agents: 1,
Lines 93–99 at 318 (were 95–101 at 116)
98− assert.deepEqual(request("--max-agents", "50", "--days", "90"), { max_agents: 50, days: 90 });
Lines 103–118 at 318 (were 105–122 at 116)
108− for (const flag of ["--max-agents", "--days"]) {
109− for (const value of ["0", "-1", "1.5", "1e1", "Infinity", "100", "abc", ""])
110− assert.throws(() => request(flag, value));
111− }
113109
114110test("login sends requested grants only at device start and retains the user's actual approval", async () => {
118− const requested = { projects: [{ project: "abso", role: "owner" as const }], max_agents: 10, days: 90 };
119− const approved = { projects: [{ project: "abso", role: "reader" }], max_agents: 1 };
Lines 205–212 at 318 (were 209–215 at 116)
212− assert.match(boxText(got, SERVER, 0), /abso \(writer\), game \(reader\)\. Up to 5 agents\./);
215212
Lines 380–401 at 318 (were 383–409 at 116)
385382
386−test("join and init pick the server: --server, ABSO_SERVER, the box's sign-in, then api.abso.dev", () => {
383+test("join and init pick the server in the one order: --server, the folder's, ABSO_SERVER, then prod", () => {
388386 const args = (server?: string) => ({ positionals: [], flags: new Map(server ? [["server", server]] : []) });
389− const none = { env: {} };
390− assert.equal(serverFrom(args(), none, h), "https://api.abso.dev", "nothing signed in: the abso API");
393− assert.equal(serverFrom(args(), none, h), SERVER, "the server abso login signed this box in to");
391+ assert.equal(serverFrom(args(), none), "https://api.abso.dev", "a sign-in elsewhere doesn't pick the server");
394392 assert.deepEqual(signedInServers(h, Date.now() + 2e6), [], "an expired sign-in doesn't count");
395− assert.equal(serverFrom(args(), { env: { ABSO_SERVER: "https://env.example" } }, h), "https://env.example");
393+ assert.equal(serverFrom(args(), { ...none, env: { ABSO_SERVER: "https://env.example" } }), "https://env.example");
397− serverFrom(args("https://flag.example"), { env: { ABSO_SERVER: "https://env.example" } }, h),
395+ serverFrom(args("https://flag.example"), { ...none, env: { ABSO_SERVER: "https://env.example" } }),
400− writeBox({ ...record, server: "https://other.abso.example", expiresAt: Date.now() + 1e6 }, h);
401− writeBox({ ...record, expiresAt: Date.now() + 1e6 }, h);
402− assert.throws(
403− () => serverFrom(args(), none, h),
404− /signed in to https:\/\/other\.abso\.example and https:\/\/staging\.abso\.example: say which with --server/,
405− );
406− assert.equal(serverFrom(args(SERVER), none, h), SERVER, "--server settles it");
408400
409401test("join with no --agent takes the box's name, skips names this box holds, and moves past a taken one", async () => {
Lines 419–554 at 318 (were 427–439 at 116)
430423
431− const limit = server(
432− [
433− [200, { box_id: record.id, agents: [] }],
434− [409, { error: "this box is at its agent limit" }],
435− ],
436− [],
424+test("abso init from a box (abso 663): one key for every try, waiting out a pending create; abso box says all projects", async () => {
425+ const record = { server: SERVER, id: "b_1", credential: CREDENTIAL, grant, expiresAt: Date.now() + 86_400_000 };
438− await assert.rejects(mintFreeName(record, "abso", "snow", limit), /this box is at its agent limit \(5\)/);
452+ assert.ok(seen.every((s) => s.path === "/box/projects" && s.key === "33333333-3333-4333-8333-333333333333"));
454+ assert.deepEqual(JSON.parse(seen[0]!.body), { name: "made", files: [{ path: "a.txt", text: "hi\n" }] });
455+ const all = { ...record, grant: { projects: [], scopes: [{ kind: "member-all", role: "writer" }] } };
461+
462+// abso 684: in an agent's folder, login asks a person in the project instead of relaying the code.
465+ assert.equal(device, started.device_code, "the ask is made with this client's own device code");
477+
478+test("an asked login says who was asked and until when, and doesn't lead with the code (abso 684)", async () => {
488+ [200, { box_id: "b_test", box_token: CREDENTIAL, expires_at: EXPIRES, grant: { projects: [] } }],
500+ /^Asked the person who approved this agent's box \(ask 41 in abso\) to sign this box in, as at most writer\.$/,
502+ assert.match(said[1]!, /^Waiting for their answer, until .* CT\. To approve it yourself instead: /);
505+
529+
530+test("an asked login that nobody answers withdraws its ask and grants nothing (abso 684)", async () => {
- MCP
- compare on this site's /mcp
- CLI
- abso diff 116 318 client/test/box.test.ts --json
- JSON
- /christopher/abso-core/compare/116..318?file=client%2Ftest%2Fbox.test.ts&format=json