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
MCP
blame on this site's /mcp
CLI
abso blame client/src/announce.ts --draft login-timeout --json
JSON
/christopher/abso-core/blame/client/src/announce.ts?draft=login-timeout&format=json
91 linesFirst import 95% · pinch 4% · infra-split 1%Last change infra-split in version 37,

91 lines from 3 changes in 3 versions.

init0Start the project1// abso announce and abso news: a message to the project's other agents,
2// delivered once as news on each one's next edit (or the mod's next poll),
3// and the news waiting for this agent.
4
5import { newsLines } from "./api.ts";
6import { bool, type Parsed, str, UsageError } from "./args.ts";
7import { type Env, type Output, open, plural } from "./commands.ts";
8import { logNews } from "./folder.ts";
9import { newsWithTime } from "./times.ts";
11export async function runAnnounce(args: Parsed, env: Env): Promise<Output> {
12 const text = args.positionals.join(" ").trim();
13 if (text === "") throw new UsageError('say what to announce: abso announce [--to a,b] "text"');
14 const rawTo = str(args, "to");
15 const to =
16 rawTo === undefined
17 ? undefined
18 : rawTo
19 .split(",")
20 .map((a) => a.trim())
21 .filter((a) => a !== "");
22 if (to !== undefined && to.length === 0) throw new UsageError("--to names the agents, separated by commas");
23 const { api } = open(env);
24 const answer = await api.announce(text, to);
25 const who = answer.to.length === 0 ? "nobody (no other agents yet)" : answer.to.join(", ");
26 return {
27 text: `Announced to ${who}. Each gets it once, as news on their next edit, or within about 30 seconds where the abso mod runs.`,
28 json: { id: answer.id, to: answer.to },
29 };
32/** abso start: say what you are starting on, before any edit lands (#37, #13). */
33export async function runStart(args: Parsed, env: Env): Promise<Output> {
34 const { api } = open(env);
35 if (bool(args, "done")) {
36 await api.starting(null);
37 return { text: "Starting note taken back.", json: { starting: null, overlaps: [] } };
38 }
39 const text = args.positionals[0]?.trim() ?? "";
40 if (text === "") throw new UsageError('say what you are starting on: abso start "<what>" [files...]');
41 const files = args.positionals.slice(1);
42 // --issue N (#54): the issue this work is for; publish --done closes it.
43 const issueFlag = args.flags.get("issue");
44 const issue = typeof issueFlag === "string" ? Number(issueFlag) : undefined;
45 if (issue !== undefined && (!Number.isInteger(issue) || issue < 1))
46 throw new UsageError('--issue takes an issue number: abso start "<what>" --issue 12');
47 const answer = await api.starting(text, files, issue !== undefined ? { issue } : {});
48 const lines = [
49 `Starting on "${text}"${files.length > 0 ? `, naming ${files.join(", ")}` : ""}${issue !== undefined ? ` for issue ${issue}` : ""}. abso where shows it to everyone until you publish (or abso start --done).` +
50 (issue !== undefined ? ` abso publish --done closes issue ${issue}.` : ""),
51 ];
52 if (answer.overlaps.length > 0) {
53 lines.push("Already there:");
54 for (const o of answer.overlaps) {
55 const what = [
56 o.changes ? plural(o.changes, "unpublished change") : "",
57 o.starting ? `starting on "${o.starting}"` : "",
58 ]
59 .filter((w) => w !== "")
60 .join(", ");
61 lines.push(` ${o.file}: ${o.agent}${what === "" ? "" : ` (${what})`}`);
62 }
infra-split37Comments and test names give each reason in plain words, without naming who raised it Notes like "(#37, Builder 5)" or "(AVCS - Security)" become "(#37)" or go, and a private commit hash after a name goes with it. Issue numbers and references such as git's CVE-2019-1353 stay. Only comments and test names change; no behavior changes.Compare63 // The sentence people act on names who, and their note (#37: without it, an agent had to run abso where to learn it).
init0Start the project64 const agents = [...new Set(answer.overlaps.map((o) => o.agent))];
65 const notes = agents.flatMap((a) => {
66 const note = answer.overlaps.find((o) => o.agent === a && o.starting)?.starting;
67 return note === undefined ? [] : [`${a}'s "${note}"`];
68 });
69 lines.push(
70 `${agents.join(" and ")} ${agents.length === 1 ? "hears" : "hear"} of your note on their next edit. If it is the same work${notes.length > 0 ? ` as ${notes.join(" or ")}` : ""}, settle who does what first: abso announce --to ${agents.join(",")} "..." reaches ${agents.length === 1 ? "them" : "each of them"}.`,
71 );
72 }
73 return { text: lines.join("\n"), json: { ...answer } };
76export async function runNews(_args: Parsed, env: Env): Promise<Output> {
77 const { root, api } = open(env);
78 const answer = await api.news();
79 const news = newsLines(answer.news);
80 logNews(root, news);
81 if (news.length === 0) return { text: "No news.", json: { news } };
82 const at = new Map((answer.items ?? []).map((i) => [i.text, i.at]));
83 const items = news.map((text) => ({ text, at: at.get(text) ?? null }));
84 return {
pinch33Client: a tell reads as who told you and how sure that is, with what was said on the lines below: "ann (as claimed) told you:", "Robin (a person) told you:", "ann (checked) told you:" for an agent with a key of its own. A person's words are unquoted and their id is left out (news.log keeps the sentence whole). Tells are never cut in an agent's context, and later lines are indented everywhere news is printed (news, the News: block, the edit hook). What the server stores is unchanged. Client tests 273/273, tsc and biome clean.Compare85 text: [
86 `${plural(news.length, "news item")}:`,
87 ...items.map((i) => ` ${newsWithTime(i.text, i.at).replace(/\r?\n/g, "\n ")}`),
88 ].join("\n"),
init0Start the project89 json: { news, items, delivered: Date.now() },
90 };