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 269 to 318

Compare

+18 −2 in 4 places
Lines 2–15 at 318 (were 2–12 at 269)
22// delivered once as news on each one's next edit (or the mod's next poll),
33// and the news waiting for this agent.
44
5+import { writeFileSync } from "node:fs";
6+import { join } from "node:path";
57import { newsLines } from "./api.ts";
68import { bool, type Parsed, str, UsageError } from "./args.ts";
79import { type Env, type Output, open, plural } from "./commands.ts";
810import { logNews } from "./folder.ts";
9−import { follow, monitorArgs, type Socket, streamText } from "./news-stream.ts";
11+import { follow, monitorArgs, type Socket, STREAM_MARK, streamMarkUntil, streamText } from "./news-stream.ts";
12+import { stateDir } from "./state-dir.ts";
1013import { newsWithTime } from "./times.ts";
1114
1215export async function runAnnounce(args: Parsed, env: Env): Promise<Output> {
Lines 28–34 at 318 (were 25–31 at 269)
2528 const answer = await api.announce(text, to);
2629 const who = answer.to.length === 0 ? "nobody (no other agents yet)" : answer.to.join(", ");
2730 return {
28− text: `Announced to ${who}. Each gets it once, as news on their next edit, or within about 30 seconds where the abso mod runs.`,
31+ text: `Announced to ${who}. Each gets it once, as news on their next edit, within about 5 minutes in a working chat where the abso mod runs, or at once where it holds its news stream.`,
2932 json: { id: answer.id, to: answer.to },
3033 };
3134}
Lines 77–98 at 318 (were 74–85 at 269)
7477 return { text: lines.join("\n"), json: { ...answer } };
7578}
7679
80+/** Says this folder's seat holds its news stream until `until`, so the abso-hooks mod's poll stands down. Best effort. */
81+function markStream(root: string, until: number): void {
82+ try {
83+ writeFileSync(join(stateDir(root), STREAM_MARK), JSON.stringify({ until }));
84+ } catch {
85+ // The mod keeps polling; nothing is lost.
86+ }
87+}
7789export async function runNews(args: Parsed, env: Env): Promise<Output> {
7890 const { root, config, api } = open(env);
7991 if (bool(args, "stream") && bool(args, "follow"))
8092 throw new UsageError("abso news takes --stream or --follow, not both");
8193 if (bool(args, "stream")) {
8294 const ticket = await api.newsTicket();
95+ markStream(root, streamMarkUntil(ticket, Date.now()));
8396 return {
8497 text: streamText(ticket, config.project, config.agent),
8598 json: { monitor: monitorArgs(ticket, config.project, config.agent), expiresAt: ticket.expiresAt },
Lines 107–120 at 318 (were 94–104 at 269)
94107 try {
95108 const ended = await follow({
96109 mint: () => api.newsTicket(),
110+ // A frame is a wake: read the news, which marks it heard, and print that (news-stream.ts).
111+ take: async () => newsLines((await api.news()).news),
97112 connect: (url, protocols) => new WebSocket(url, [...protocols]) as unknown as Socket,
98113 write: (line) => {
99114 logNews(root, [line]);
100115 env.write(`${line.replace(/\r?\n/g, " ")}\n`);
101116 },
117+ held: (until) => markStream(root, until),
102118 note: (line) =>
103119 env.write(`${line}
104120`),
MCP
compare on this site's /mcp
CLI
abso diff 269 318 client/src/announce.ts --json
JSON
/christopher/abso-core/compare/269..318?file=client%2Fsrc%2Fannounce.ts&format=json