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/queue.ts --version 271 --json
JSON
/christopher/abso-core/blame/client/src/queue.ts?version=271&format=json
179 linesFirst import 83% · pinch 9% · rename 7% · infra-split 1% · review 1%Last change rename in version 100,

179 lines from 6 changes in 6 versions.

review28Client: abso.json is the project file (avcs.json still read; a new project gets abso.json unless it has either); new folders get .abso when no installed mod is older than 0.2.0; both mods are 0.2.0 (abso 253, 224)Compare1// The merge queue on the client (#39): with "queue": true in abso.json, a
init0Start the project2// publish to shared waits in the queue until a batch with it passes the
3// project's check, and lands, or is pulled with the check's output. publish
4// waits for that, up to a cap under the chat's 2-minute command limit; status
5// shows the queue; abso unqueue takes a queued publish back.
6
7import { type Api, newsLines, type QueueItem, type QueueState } from "./api.ts";
8import { type Parsed, UsageError } from "./args.ts";
pinch78Biome is silent: about 90 hints cleared. String joins as templates, dotted keys, unused imports, variables and a private method removed, optional chains (one kept boolean with === true), the preset field instead of the deprecated recommended. Two rules off where they don't fit: noExplicitAny in the hook modules, whose engine types come from the host, and noTemplateCurlyInString in tests, which hold source text as data.Compare9import { type Env, type Output, open } from "./commands.ts";
init0Start the project10import { logNews } from "./folder.ts";
infra-split39More comments and test names give their reason without naming who raised it The same cleanup as version 37, for notes it missed because they were wrapped or worded differently: "(#37, Playtester 1)" becomes "(#37)", "(#39, agreed with Engine)" becomes "(#39)", and a commit hash after a name goes with the name. Issue numbers stay. No behavior changes.Compare12/** How long publish waits by default: under the 2 minutes a Claude Code shell command gets (#39). */
init0Start the project13export const WAIT_SECONDS = 100;
15/** Exit code for a publish still in the queue when the wait ends (#39). */
16export const STILL_QUEUED = 3;
18export type QueueOutcome =
19 | { readonly kind: "landed"; readonly version: number; readonly news: string[] }
20 | { readonly kind: "pulled"; readonly text: string; readonly news: string[] }
21 /** Out of the queue, but neither the last round nor the news says how (another round ran since, or the news was taken). */
22 | { readonly kind: "gone"; readonly news: string[] }
23 | { readonly kind: "waiting"; readonly state: QueueState | undefined };
25/** Where a queued publish stands: being checked, or how many wait ahead of it. */
26export function standing(items: readonly QueueItem[], id: number): string {
27 const at = items.findIndex((q) => q.id === id);
28 if (at < 0) return "out of the queue";
29 if (items[at]!.checking) {
30 const batch = items.filter((q) => q.checking).length;
31 return batch === 1 ? "being checked" : `being checked in a batch of ${batch}`;
32 }
rename100abso publish is now abso push, abso sync is now abso pull (abso 427) Commands, help, flags, messages, MCP tool names and descriptions, hook text, README, SKILL.md and tests say push and pull; "shared" stays the noun ("Pushed version N"). No aliases, no notices. A queued push that was "pulled" is now "turned back", so pull means one thing. push -f/--force/-u/--all/--tags and pull --rebase/--ff-only/--squash refuse with one plain line naming the abso way; push and pull take no remote or branch. Kept as stored: log entry kinds (publish, sync, pulled), HTTP route paths, the pipeline trigger on: publish, the yours (unpublished) marker, npm-publish.Compare33 return at === 0 ? "next to be checked" : `waiting, ${at} ${at === 1 ? "push" : "pushes"} ahead of it`;
init0Start the project34}
36/**
37 * Wait for queued publish `id` to land or be pulled, polling the queue every
38 * `pollMs` until `waitMs` has passed. A failed poll isn't a failed publish:
39 * it tries again until the time is up. The outcome comes from the last
40 * round, else from the news that says it (which is taken, so it's handed back
41 * to print).
42 */
43export async function waitForQueued(
44 api: Api,
45 id: number,
46 waitMs: number,
47 say: (line: string) => void,
48 pollMs = 3000,
49): Promise<QueueOutcome> {
50 const until = Date.now() + waitMs;
51 let state: QueueState | undefined;
52 let said = "";
53 while (Date.now() < until) {
54 await new Promise((ok) => setTimeout(ok, Math.min(pollMs, Math.max(0, until - Date.now()))));
55 try {
56 state = await api.queueState();
57 } catch {
58 continue;
59 }
60 if (!state.items.some((q) => q.id === id)) return outcomeOf(api, id, state);
61 const now = state.paused
62 ? `the queue is paused: ${state.paused.reason}; next try ${state.paused.nextTry.slice(11, 16)} UTC`
63 : standing(state.items, id);
rename100abso publish is now abso push, abso sync is now abso pull (abso 427) Commands, help, flags, messages, MCP tool names and descriptions, hook text, README, SKILL.md and tests say push and pull; "shared" stays the noun ("Pushed version N"). No aliases, no notices. A queued push that was "pulled" is now "turned back", so pull means one thing. push -f/--force/-u/--all/--tags and pull --rebase/--ff-only/--squash refuse with one plain line naming the abso way; push and pull take no remote or branch. Kept as stored: log entry kinds (publish, sync, pulled), HTTP route paths, the pipeline trigger on: publish, the yours (unpublished) marker, npm-publish.Compare64 if (now !== said) say(`abso: your push is ${now}.\n`);
init0Start the project65 said = now;
66 }
67 return { kind: "waiting", state };
70async function outcomeOf(api: Api, id: number, state: QueueState): Promise<QueueOutcome> {
71 const all = await api.news().then(
72 (a) => newsLines(a.news),
73 () => [] as string[],
74 );
75 // The news names the outcome; one publish per agent is the usual case, so the newest such line is ours.
76 // publish says the outcome itself, so that line isn't printed again as news.
77 const said = [...all]
78 .reverse()
rename100abso publish is now abso push, abso sync is now abso pull (abso 427) Commands, help, flags, messages, MCP tool names and descriptions, hook text, README, SKILL.md and tests say push and pull; "shared" stays the noun ("Pushed version N"). No aliases, no notices. A queued push that was "pulled" is now "turned back", so pull means one thing. push -f/--force/-u/--all/--tags and pull --rebase/--ff-only/--squash refuse with one plain line naming the abso way; push and pull take no remote or branch. Kept as stored: log entry kinds (publish, sync, pulled), HTTP route paths, the pipeline trigger on: publish, the yours (unpublished) marker, npm-publish.Compare79 .find((n) => /^Your queued push ".*" (landed as version \d+|was turned back: )/s.test(n));
init0Start the project80 const news = all.filter((n) => n !== said);
81 const last = state.last;
82 const landed =
83 last && (last.kind === "landed" || last.kind === "pulled") ? last.versions.find((v) => v.id === id) : undefined;
84 if (landed) return { kind: "landed", version: landed.version, news };
85 const version = said === undefined ? undefined : /landed as version (\d+)\.$/.exec(said)?.[1];
86 if (version !== undefined) return { kind: "landed", version: Number(version), news };
87 if (said !== undefined) return { kind: "pulled", text: said, news };
88 if (last?.kind === "pulled" && last.pulled.includes(id))
89 return {
90 kind: "pulled",
rename100abso publish is now abso push, abso sync is now abso pull (abso 427) Commands, help, flags, messages, MCP tool names and descriptions, hook text, README, SKILL.md and tests say push and pull; "shared" stays the noun ("Pushed version N"). No aliases, no notices. A queued push that was "pulled" is now "turned back", so pull means one thing. push -f/--force/-u/--all/--tags and pull --rebase/--ff-only/--squash refuse with one plain line naming the abso way; push and pull take no remote or branch. Kept as stored: log entry kinds (publish, sync, pulled), HTTP route paths, the pipeline trigger on: publish, the yours (unpublished) marker, npm-publish.Compare91 text: `Your queued push was turned back: the project's check failed on it.${last.output ? `\n${last.output.trimEnd()}` : ""}`,
init0Start the project92 news,
93 };
94 return { kind: "gone", news };
97/**
infra-split39More comments and test names give their reason without naming who raised it The same cleanup as version 37, for notes it missed because they were wrapped or worded differently: "(#37, Playtester 1)" becomes "(#37)", "(#39, agreed with Engine)" becomes "(#39)", and a commit hash after a name goes with the name. Issue numbers stay. No behavior changes.Compare98 * A pull, said for the publisher (#39): the check's output
init0Start the project99 * first, then the verdict as the last line, since that's the line an agent
100 * acts on. The engine's news has the output in the middle of its sentence.
101 */
102export function pulledText(news: string): string {
103 const m =
rename100abso publish is now abso push, abso sync is now abso pull (abso 427) Commands, help, flags, messages, MCP tool names and descriptions, hook text, README, SKILL.md and tests say push and pull; "shared" stays the noun ("Pushed version N"). No aliases, no notices. A queued push that was "pulled" is now "turned back", so pull means one thing. push -f/--force/-u/--all/--tags and pull --rebase/--ff-only/--squash refuse with one plain line naming the abso way; push and pull take no remote or branch. Kept as stored: log entry kinds (publish, sync, pulled), HTTP route paths, the pipeline trigger on: publish, the yours (unpublished) marker, npm-publish.Compare104 /^Your queued push (".*") was turned back: ([^\n]*?)(?::\n([\s\S]*?))?\.? Its changes are still in your draft\.$/s.exec(
init0Start the project105 news.replace(/\n\. Its changes/, ". Its changes"),
106 );
rename100abso publish is now abso push, abso sync is now abso pull (abso 427) Commands, help, flags, messages, MCP tool names and descriptions, hook text, README, SKILL.md and tests say push and pull; "shared" stays the noun ("Pushed version N"). No aliases, no notices. A queued push that was "pulled" is now "turned back", so pull means one thing. push -f/--force/-u/--all/--tags and pull --rebase/--ff-only/--squash refuse with one plain line naming the abso way; push and pull take no remote or branch. Kept as stored: log entry kinds (publish, sync, pulled), HTTP route paths, the pipeline trigger on: publish, the yours (unpublished) marker, npm-publish.Compare107 if (!m) return `${news}\nNot pushed. Fix it, then push again.`;
init0Start the project108 const output = m[3]?.trimEnd() ?? "";
109 return [
110 ...(output === "" ? [] : ["The check's output ends:", output]),
rename100abso publish is now abso push, abso sync is now abso pull (abso 427) Commands, help, flags, messages, MCP tool names and descriptions, hook text, README, SKILL.md and tests say push and pull; "shared" stays the noun ("Pushed version N"). No aliases, no notices. A queued push that was "pulled" is now "turned back", so pull means one thing. push -f/--force/-u/--all/--tags and pull --rebase/--ff-only/--squash refuse with one plain line naming the abso way; push and pull take no remote or branch. Kept as stored: log entry kinds (publish, sync, pulled), HTTP route paths, the pipeline trigger on: publish, the yours (unpublished) marker, npm-publish.Compare111 `Not pushed: your queued push ${m[1]} was turned back: ${m[2]!.replace(/\.$/, "")}. Its changes are still in your draft; fix them, then push again.`,
init0Start the project112 ].join("\n");
115/** The lines status shows about the queue: who waits, what is being checked, a pause. Nothing while it's empty. */
116export function queueText(queue: QueueState | null | undefined, me: string): string[] {
117 if (!queue) return [];
118 const lines: string[] = [];
119 if (queue.items.length > 0) {
120 const checking = queue.items.filter((q) => q.checking);
121 const waiting = queue.items.filter((q) => !q.checking);
122 const who = (q: QueueItem) => `${q.agent === me ? `yours (${q.id})` : q.agent}`;
123 lines.push(
124 `Merge queue: ${[
125 checking.length > 0
126 ? `checking ${checking.length === 1 ? who(checking[0]!) : `a batch of ${checking.length} (${checking.map(who).join(", ")})`}`
127 : "",
128 waiting.length > 0 ? `waiting: ${waiting.map(who).join(", ")}` : "",
129 ]
130 .filter((p) => p !== "")
131 .join("; ")}.`,
132 );
133 }
134 if (queue.paused)
135 lines.push(
136 `The merge queue is paused since ${queue.paused.since.slice(11, 16)} UTC: ${queue.paused.reason}; next try ${queue.paused.nextTry.slice(11, 16)} UTC.`,
137 );
138 return lines;
pinch36waiting --mine lists your publishes still in the merge queue: where each stands (being checked, or how many wait ahead of it), whether the queue is paused, and that the outcome comes as news; --json carries them as queued. A server without a queue, or one that can't be read, leaves them out rather than failing the asks.Compare141/**
142 * What abso waiting --mine says about this agent's own publishes in the merge queue: where each stands, whether
143 * the queue is paused, and how the outcome comes. Nothing when none of theirs waits.
144 */
145export function queuedLines(queue: QueueState | null | undefined, me: string): string[] {
146 const items = queue?.items ?? [];
147 const mine = items.filter((q) => q.agent === me);
148 if (mine.length === 0) return [];
149 return [
150 ...mine.map(
rename100abso publish is now abso push, abso sync is now abso pull (abso 427) Commands, help, flags, messages, MCP tool names and descriptions, hook text, README, SKILL.md and tests say push and pull; "shared" stays the noun ("Pushed version N"). No aliases, no notices. A queued push that was "pulled" is now "turned back", so pull means one thing. push -f/--force/-u/--all/--tags and pull --rebase/--ff-only/--squash refuse with one plain line naming the abso way; push and pull take no remote or branch. Kept as stored: log entry kinds (publish, sync, pulled), HTTP route paths, the pipeline trigger on: publish, the yours (unpublished) marker, npm-publish.Compare151 (q) => `Your push ${q.id} (${JSON.stringify(q.message)}) is in the merge queue: ${standing(items, q.id)}.`,
pinch36waiting --mine lists your publishes still in the merge queue: where each stands (being checked, or how many wait ahead of it), whether the queue is paused, and that the outcome comes as news; --json carries them as queued. A server without a queue, or one that can't be read, leaves them out rather than failing the asks.Compare152 ),
153 ...(queue?.paused ? [`The merge queue is paused: ${queue.paused.reason}.`] : []),
rename100abso publish is now abso push, abso sync is now abso pull (abso 427) Commands, help, flags, messages, MCP tool names and descriptions, hook text, README, SKILL.md and tests say push and pull; "shared" stays the noun ("Pushed version N"). No aliases, no notices. A queued push that was "pulled" is now "turned back", so pull means one thing. push -f/--force/-u/--all/--tags and pull --rebase/--ff-only/--squash refuse with one plain line naming the abso way; push and pull take no remote or branch. Kept as stored: log entry kinds (publish, sync, pulled), HTTP route paths, the pipeline trigger on: publish, the yours (unpublished) marker, npm-publish.Compare154 `${mine.length === 1 ? "It lands or is turned back" : "Each lands or is turned back"} once the project's check runs on it; the outcome comes as news, and abso unqueue takes ${mine.length === 1 ? "it" : "them"} back.`,
pinch36waiting --mine lists your publishes still in the merge queue: where each stands (being checked, or how many wait ahead of it), whether the queue is paused, and that the outcome comes as news; --json carries them as queued. A server without a queue, or one that can't be read, leaves them out rather than failing the asks.Compare155 ];
init0Start the project158/** abso unqueue: take this agent's queued publishes back; their changes stay in the draft. */
159export async function runUnqueue(args: Parsed, env: Env): Promise<Output> {
160 if (args.positionals.length > 0)
rename100abso publish is now abso push, abso sync is now abso pull (abso 427) Commands, help, flags, messages, MCP tool names and descriptions, hook text, README, SKILL.md and tests say push and pull; "shared" stays the noun ("Pushed version N"). No aliases, no notices. A queued push that was "pulled" is now "turned back", so pull means one thing. push -f/--force/-u/--all/--tags and pull --rebase/--ff-only/--squash refuse with one plain line naming the abso way; push and pull take no remote or branch. Kept as stored: log entry kinds (publish, sync, pulled), HTTP route paths, the pipeline trigger on: publish, the yours (unpublished) marker, npm-publish.Compare161 throw new UsageError("unqueue takes no arguments: it takes back every push of yours still in the merge queue");
init0Start the project162 const { root, api } = open(env);
163 const answer = await api.unqueue();
164 // The engine says it as news too ("you withdrew it"); this command's own text says the same, so it isn't printed twice.
165 const news = await api.news().then(
166 (a) => newsLines(a.news),
167 () => [] as string[],
168 );
169 logNews(root, news);
rename100abso publish is now abso push, abso sync is now abso pull (abso 427) Commands, help, flags, messages, MCP tool names and descriptions, hook text, README, SKILL.md and tests say push and pull; "shared" stays the noun ("Pushed version N"). No aliases, no notices. A queued push that was "pulled" is now "turned back", so pull means one thing. push -f/--force/-u/--all/--tags and pull --rebase/--ff-only/--squash refuse with one plain line naming the abso way; push and pull take no remote or branch. Kept as stored: log entry kinds (publish, sync, pulled), HTTP route paths, the pipeline trigger on: publish, the yours (unpublished) marker, npm-publish.Compare170 const others = news.filter((n) => !/^Your queued push ".*" was turned back: you withdrew it\./s.test(n));
init0Start the project171 const ids = answer.pulled;
172 return {
173 text: [
rename100abso publish is now abso push, abso sync is now abso pull (abso 427) Commands, help, flags, messages, MCP tool names and descriptions, hook text, README, SKILL.md and tests say push and pull; "shared" stays the noun ("Pushed version N"). No aliases, no notices. A queued push that was "pulled" is now "turned back", so pull means one thing. push -f/--force/-u/--all/--tags and pull --rebase/--ff-only/--squash refuse with one plain line naming the abso way; push and pull take no remote or branch. Kept as stored: log entry kinds (publish, sync, pulled), HTTP route paths, the pipeline trigger on: publish, the yours (unpublished) marker, npm-publish.Compare174 `Took back ${ids.length === 1 ? `queued push ${ids[0]}` : `queued pushes ${ids.join(", ")}`}: ${ids.length === 1 ? "its" : "their"} changes are still in your draft, unpushed.`,
init0Start the project175 ...others.map((n) => ` ${n}`),
176 ].join("\n"),
177 json: { pulled: ids, news: others },
178 };